Skip to content

Commit b668bb0

Browse files
ishtartecclaude
andcommitted
docs: update README and CLAUDE.md with all v0.9.0 features
README: add ARAM bench swap, win probability, overlay improvements CLAUDE.md: full rewrite reflecting current architecture, commands, patterns, data sources, and known issues Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 62109c7 commit b668bb0

2 files changed

Lines changed: 42 additions & 21 deletions

File tree

CLAUDE.md

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,77 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
```bash
88
# Start Tauri app in dev mode (Rust backend + Vite hot-reload frontend)
9-
npm run tauri dev
9+
pnpm tauri dev
1010

1111
# Build production binary
12-
npm run tauri build
12+
pnpm tauri build
1313

1414
# Frontend-only dev server (no Tauri shell, runs on localhost:1420)
15-
npm run dev
15+
pnpm dev
1616

17-
# Type-check + build frontend only
18-
npm run build
17+
# Type-check frontend only
18+
npx tsc --noEmit
19+
20+
# Rust type-check only
21+
cd src-tauri && cargo check
22+
23+
# Release a new version (bumps version in 3 files, commits, tags, pushes)
24+
./scripts/release.sh 0.X.0
1925
```
2026

2127
There are no tests configured in this project.
2228

2329
## Architecture
2430

25-
**QueryLoL Desktop** is a League of Legends companion app built with Tauri 2 (Rust backend) and React 19 (TypeScript frontend).
31+
**QueryLoL Desktop** is a League of Legends companion app built with Tauri 2 (Rust backend) and React 19 (TypeScript frontend). Supports Windows and macOS.
2632

2733
### Backend (src-tauri/src/)
2834

29-
- **lib.rs** — Tauri app setup, command handlers, and the main `watcher_loop`/`poll_loop`. The watcher continuously detects the League client, and the poll loop (1s interval) tracks game phase transitions (lobby → champ select → in-game → post-game), triggering builds, recommendations, and auto-apply actions.
30-
- **lcu.rs** — League Client Update (LCU) API integration. Connects via lockfile (`riot:password` + port over HTTPS with self-signed cert). Handles all client interactions: reading game state, applying runes/spells/items, pick/ban actions, match history, post-game stats.
31-
- **opgg.rs** — OP.GG API integration (`https://lol-api-champion.op.gg/api`). Fetches builds, counters, ban suggestions, pick recommendations (scored 0-100), and game predictions with early/late phase analysis.
32-
- **models.rs** — All serde-serializable data structures shared between backend and frontend.
35+
- **lib.rs** — Tauri app setup, command handlers (~15 commands), `watcher_loop` (LCU connection), `poll_loop` (1s game phase polling), and `overlay_loop` (50ms TAB key polling via device_query). Manages phase transitions: lobby → champ select → in-game → post-game.
36+
- **lcu.rs** — League Client Update (LCU) API integration. Connects via lockfile (platform-specific paths for macOS/Windows). Handles: game state, applying runes/spells/items, pick/ban, match history, post-game stats, live game data, ARAM bench swap. Also contains `poll_live_game_data()` for the Live Client Data API (port 2999) and `compute_phase_stats()`/`compute_gold_timeline()` from snapshot data.
37+
- **opgg.rs** — OP.GG API integration. Fetches builds, counters, ban suggestions, pick recommendations, game predictions, ARAM win rates.
38+
- **models.rs** — All serde-serializable data structures. Key types: `AppState`, `LiveGameState`, `LivePlayerStats`, `PostGameStats`, `PlayerSnapshot`, `AramBenchChampion`.
3339
- **config.rs** — Persistent user config (region, toggles, LP history) saved to `{app_data_dir}/config.json`.
3440

3541
### Frontend (src/)
3642

37-
- **App.tsx** — Single-file monolith containing all components (~1500 lines). No component splitting — everything from the LP chart to post-game scoreboard lives here.
38-
- **App.css** — Dark theme styled with CSS variables (no preprocessor). League of Legends aesthetic with gold/blue/red accents.
43+
- **main.tsx** — Entry point. Detects overlay vs main window via `getCurrentWebviewWindow().label` and renders the appropriate component.
44+
- **App.tsx** — Single-file containing all components (~2900 lines). Includes: champion select views, live game with spell tracking, post-game analysis, overlay, tooltips, ARAM bench, improvement panel, matchup analysis, damage composition, win probability model, and all static data (champion traits, power curves, elo benchmarks, spell cooldowns).
45+
- **App.css** — Dark theme with CSS variables. League of Legends aesthetic with gold/blue/red accents. Custom scrollbar, overlay styles, position icons.
3946

4047
### State Flow
4148

4249
1. Rust backend detects game phase change via LCU polling
4350
2. Backend updates centralized `SharedState` (`Arc<Mutex<AppState>>`)
4451
3. Backend emits `app-state-changed` Tauri event with full `AppState` payload
4552
4. React listener receives event → `setState(e.payload)` → re-render
53+
5. Overlay window polls state via `invoke("get_state")` every 1s as fallback
4654

47-
All HTTP requests happen in Rust only — the frontend never calls external APIs directly. Frontend communicates with backend via `invoke("command_name", { args })` for user-initiated actions (apply build, pick/ban, change settings).
55+
All HTTP requests happen in Rust only. Frontend communicates with backend via `invoke("command_name", { args })` for user-initiated actions.
4856

4957
### Key Patterns
5058

5159
- **No Redux/state library** — pure React `useState` + Tauri event listener
52-
- **Draft change detection** — hashing of draft state to avoid redundant API calls in the poll loop
53-
- **Error handling**`Result<T, String>` in Rust, try/catch on `invoke` in React with toast notifications (5s timeout)
60+
- **Draft change detection** — hashing of draft state to avoid redundant API calls
61+
- **Two windows** — main app + overlay (transparent, always-on-top, click-through)
62+
- **Snapshot collection** — during live game, player stats recorded every 30s for post-game phase analysis
63+
- **Win probability** — logistic model based on gold diff, game time, dragons, baron
64+
- **Platform-conditional code**`#[cfg(target_os)]` for macOS/Windows lockfile paths, process detection, notifications
5465
- **TypeScript strict mode** enabled (`noUnusedLocals`, `noUnusedParameters`)
5566

5667
## Data Sources
5768

5869
| Source | Purpose |
5970
|--------|---------|
60-
| Riot LCU (local HTTPS) | Game state, summoner info, apply builds, match history |
61-
| OP.GG API | Builds, counters, recommendations, predictions |
62-
| Data Dragon (Riot CDN) | Champion/item/rune/spell metadata and icons |
63-
| CommunityDragon | Rank emblems, stat shard icons |
71+
| Riot LCU (local HTTPS) | Game state, summoner info, apply builds, match history, ARAM bench |
72+
| Riot Live Client Data (port 2999) | Real-time in-game stats: KDA, CS, gold, items, events |
73+
| OP.GG API | Builds, counters, recommendations, predictions, ARAM win rates |
74+
| Data Dragon (Riot CDN) | Champion/item/rune/spell metadata, icons, descriptions |
75+
| CommunityDragon | Rank emblems, stat shard icons, position icons |
76+
77+
## Known Issues
78+
79+
- **macOS Accessibility**: Overlay (TAB hold) requires Accessibility permission. In dev mode, the binary changes on each compile, invalidating the permission. In production (DMG), it persists.
80+
- **LCU match details**: `timeline.lane` field is unreliable for position detection. We use Smite detection + role heuristics as fallback.
81+
- **LCU ranked stats**: The endpoint returns 0 losses for other players — we hide W/L when data is incomplete.
82+
- **OP.GG ARAM tier list**: Returns different JSON format than ranked — we fallback to the ranked tier list with ARAM position filter.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Built with **Tauri** (Rust) + **React** (TypeScript). Lightweight (~15MB), no Ov
3636
- **One-click pick/ban** — click any recommendation or ban suggestion to lock it in
3737
- **Auto-lock** — optionally auto-lock your champion selection
3838
- **Full draft visualization** — ally/enemy picks, bans, and positions with role icons displayed in a 3-column layout
39+
- **ARAM bench** — shows available bench champions sorted by ARAM win rate, click to swap
3940

4041
### Lobby
4142
- **Improvement priorities** — top 3 areas to improve based on your ranked history vs elo benchmarks, with visual bars and actionable advice
@@ -61,7 +62,8 @@ Built with **Tauri** (Rust) + **React** (TypeScript). Lightweight (~15MB), no Ov
6162
- **Power spike alerts** — "400g to [item]" for your next core item, and "Enemy completed [item]" when enemies buy key items
6263
- **Objective timers** — Baron buff (3:00), Elder Dragon buff (2:30), and Dragon Soul tracking with countdown and team indicator
6364
- **Objective feed** — dragons, baron, herald, turrets, inhibitors, and multikills with timestamps
64-
- **In-game overlay** — hold TAB to show a compact overlay with gold diff, enemy KDA/spells, and objective timers (Windows, borderless windowed mode)
65+
- **Win probability** — real-time win % estimate based on gold diff, game time, dragons, and baron (displayed in gold bar and overlay)
66+
- **In-game overlay** — hold TAB to show a compact overlay with win probability, lane gold diffs, and objective timers (borderless windowed mode, configurable position)
6567
- **Player profiles** — click any player to view their match history in an overlay
6668

6769
### Post-Game Analysis
@@ -75,7 +77,7 @@ Built with **Tauri** (Rust) + **React** (TypeScript). Lightweight (~15MB), no Ov
7577
- **MVP badge** — awarded to the top performer based on a composite score
7678
- **Multikill badges** — triple, quadra, and penta kill indicators
7779
- **Final items** — complete end-game item build for each player with tooltips
78-
- **Gold advantage timeline** — SVG chart showing gold diff over time with death markers
80+
- **Gold advantage timeline** — SVG chart showing gold diff over time with death markers and win probability curve overlay
7981
- **Elo comparison** — your CS/min, vision/min, KDA, damage share, KP, and gold/min compared against your rank's average with percentage deltas
8082
- **Performance by phase** — CS/min, gold/min, and KDA broken down by early (0-14m), mid (14-25m), and late (25m+) game phases
8183
- **Player profiles** — click any player name to view their ranked info and match history

0 commit comments

Comments
 (0)