Skip to content

Refactor: split lib.rs and main.js into modules; add unit tests for pure helpers #82

Description

@astetic-dev

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

  1. Rust: split into modules (config, pty, branding, speech, dropper) — mechanical, the section markers already exist.
  2. JS: split main.js into ES modules (index.html already loads it with type="module").
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions