Problem
src-tauri/src/lib.rs (~1700 lines) and src/main.js (~2000 lines) each hold five clearly separated domains (PTY/sessions, config/branding, dropper, TTS/STT, preview) in one file, and there are zero tests — while the pure helpers (mdToHtml/mdSafeUrl, build_command, unique_path, the hand-rolled b64, clampMode) are ideal unit-test targets.
Proposed fix
- Rust: split into modules (
config, pty, branding, speech, dropper) — mechanical, the section markers already exist.
- JS: split
main.js into ES modules (index.html already loads it with type="module").
- Add unit tests for the pure helpers on both sides (Rust:
cargo test; JS: needs the module split first).
Step 3 for Rust can land first; the rest is a larger mechanical refactor.
Problem
src-tauri/src/lib.rs(~1700 lines) andsrc/main.js(~2000 lines) each hold five clearly separated domains (PTY/sessions, config/branding, dropper, TTS/STT, preview) in one file, and there are zero tests — while the pure helpers (mdToHtml/mdSafeUrl,build_command,unique_path, the hand-rolledb64,clampMode) are ideal unit-test targets.Proposed fix
config,pty,branding,speech,dropper) — mechanical, the section markers already exist.main.jsinto ES modules (index.htmlalready loads it withtype="module").cargo test; JS: needs the module split first).Step 3 for Rust can land first; the rest is a larger mechanical refactor.