# Development ## Setup (Windows) 1. Node 22+, Rust stable (MSVC), Visual Studio C++ build tools, 7-Zip. 2. `npm ci` 3. `.\scripts\fetch-libmpv.ps1` downloads the shinchiro `mpv-dev-x86_64` build (the Windows libmpv builds linked from mpv.io) into `vendor/mpv/windows`. 4. Put a `.env` in the repository root for the development sign-in: `PLEX_SERVER_URL=...` and `PLEX_TOKEN=...`. It is ignored by git and only read by debug builds and the Vite dev server. Never commit or print it. 5. `npm run tauri dev` ## Setup (macOS) 1. Node 22+, Rust stable (`brew install rustup && rustup default stable`), the Xcode command line tools and Homebrew. 2. `npm ci` 3. `sh scripts/fetch-libmpv.sh` installs Homebrew's `mpv` and copies libmpv with every library it links into `vendor/mpv/macos`, rewritten to find each other there (`@loader_path`) and signed, so the bundle doesn't depend on Homebrew. Homebrew builds for the macOS it runs on, so the app's minimum macOS is that of the build machine (`scripts/build.sh` sets it from the libraries). 4. `.env` as on Windows, then `npm run tauri dev`. Debug builds on macOS keep the Plex token in `dev-secrets.json` in the app data folder rather than the Keychain: every rebuild is a new unsigned binary, which the Keychain would ask about again. Release builds always use the Keychain. The interface alone runs in a browser with `npm run dev` (port 1420), which is handy for layout work; playback, downloads and native dialogs need the desktop app. In development builds the stores are available as `window.__kaleido` for debugging. To drive the desktop app from scripts, start it with `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-debugging-port=9333` and attach over the Chrome DevTools Protocol. ## Checks ```powershell npm run typecheck npm test cargo check --manifest-path src-tauri/Cargo.toml ``` Playback tests change real Plex progress; resume an in-progress title near its saved position, or restore it afterwards. Selecting audio or subtitle tracks is saved to Plex for that file. Up Next: automatic episode credits open the screen immediately; button-only credits open it on click, and EOF opens it regardless of the credits preference. There is one autoplay timer. Clicks, keypresses (including Tab), and scrolling cancel it; pointer movement leaves it running. Esc returns to the video; F/F11 toggles full screen. The video rectangle must follow window resizes and DPI changes and return to the full window on dismissal, episode changes, errors, and closing. Verify those native video transitions on a GPU-equipped machine; browser layout checks cannot prove rendering. ## Diagnostics `src-tauri/src/diagnostics.rs` writes to the app's log folder (`%LOCALAPPDATA%\tv.kaleido.desktop\logs` on Windows); nothing is uploaded. - **Hangs**: a watchdog asks the UI thread to answer every second. After 5 seconds of silence it writes `kaleido-hang-