You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
├── vitest.config.ts # Test runner config (jsdom + Tauri mocks)
80
+
├── vitest.config.ts # Test config (jsdom + Tauri mocks)
69
81
├── svelte.config.js
70
82
├── tailwind.config.js
71
83
├── postcss.config.js
@@ -74,14 +86,16 @@ pr-buddy/
74
86
75
87
### Key Files
76
88
77
-
-**`src-tauri/src/lib.rs`** — App entry point. Registers all plugins, builds the tray icon, wires Tauri commands, starts the background poller.
78
-
-**`src-tauri/src/models.rs`** — Canonical data types shared across backend. Frontend types in `src/lib/types.ts` must stay in sync (use `snake_case` field names, matching Rust's `#[serde(rename_all = "lowercase")]`).
79
-
-**`src-tauri/src/auth.rs`** — GitHub Device Flow. Client ID is hardcoded with env var override (`GITHUB_CLIENT_ID`).
80
-
-**`src-tauri/src/poller.rs`** — Adaptive polling: 30s when PRs have pending checks or are in merge queue, 120s otherwise.
81
-
-**`src-tauri/src/notifications.rs`** — `diff_pr_states()` compares old/new PR snapshots to detect state transitions.
82
-
-**`src-tauri/tauri.conf.json`** — Window is hidden by default (tray-only), 380×520px, no decorations, `alwaysOnTop`.
When a user asks for a "UI", "menu", "section", or "status" change **without naming a surface**, assume they mean the **native tray menu first**. Most day-to-day usability is in the tray.
223
+
224
+
Only treat a request as webview-only when the user explicitly references panel/window behavior (for example: settings page, updater dialog, title bar, Auth screen, PR cards).
225
+
226
+
If both surfaces are plausible, either:
227
+
1. ask a clarifying question, or
228
+
2. state the assumption explicitly and implement tray-first.
229
+
175
230
### Tauri Command Pattern
176
231
177
-
Rust commands use `#[tauri::command]` and return `Result<T, AuthError>`. The `AuthError` type implements `Serialize` so Tauri can pass errors to the frontend. Commands access shared state via `State<'_, AppState>`:
232
+
Rust commands use `#[tauri::command]` and return `Result<T, E>` where `E` is serializable (`AuthError` for auth/github commands, `String` for settings/updater). Commands that need shared state access it via `State<'_, AppState>`:
-**Do not change `npm run dev`/`npm run build` to call Vite.** These must call `tauri dev`/`tauri build`. Frontend-only scripts are `vite:dev`/`vite:build`.
285
+
-**Do not update PR section grouping in only one layer.**`src/lib/stores.ts` and `src-tauri/src/menu.rs` must stay in sync, and `src/lib/components.test.ts` should be updated when section behavior changes.
286
+
-**Do not assume ambiguous UX requests target the Svelte webview.** Default to tray-menu changes unless the user clearly asks for panel/window behavior.
230
287
-**Do not pass arguments to `TrayIconBuilder::new()`.** Tauri v2.10 takes zero arguments. Use `.icon()` to set the icon separately.
231
288
-**Do not use `async``onMount` callbacks that return cleanup functions** in Svelte 5 — it causes type errors. See the pattern above.
232
289
-**Do not use the bundle identifier `com.prbuddy.app`.** The `.app` suffix conflicts with macOS bundle extensions. Current identifier: `com.prbuddy.dev`.
1. Run `make ci` — this runs type-check, unit tests, smoke test, and production build in sequence.
288
345
2. Alternatively, run them individually: `npm run check`, `npm run test`, `npm run smoke`, `npm run vite:build`.
289
-
3. If Rust code changed and Rust 1.77+ is available, run `cargo check` in `src-tauri/`.
346
+
3. If Rust code changed and Rust 1.77+ is available, run `(cd src-tauri && cargo fmt && cargo clippy -- -D warnings && cargo check)`.
290
347
4. Do not push to `origin/main` or `origin/master` directly.
291
348
5. Branch names must be prefixed with `mike/` (e.g., `mike/fix-tray-click`).
292
349
6.**Do not claim imports or dependencies work without running `make smoke`** — `vite build` and `svelte-check` do not catch all import resolution errors that appear in the Vite dev server.
0 commit comments