How webosbrew/dev-manager-desktop works
Main Components
a. Desktop Host (Tauri Shell)
• Bundles the Angular UI and Rust backend into a cross-platform desktop app.
• Exposes a JavaScript ↔ Rust bridge (IPC/API) for front-end ↔ back-end communication.
b. Front-end (Angular SPA)
• src/app: UI Components & pages (Add Device, Apps, Files, Terminal, Debug, etc.).
• src/core/services: Angular services that call Tauri.invoke or WebSocket for back-end actions.
c. Back-end (Rust / src-tauri)
• Main process (main.rs) & lib.rs: initializes Tauri and registers commands.
• Plugins (src-tauri/src/plugins): implement Tauri commands (e.g., cmd, file, device, shell, local_file).
• Managers (device_manager, session_manager, shell_manager, spawn_manager): encapsulate stateful operations.
• Conn_pool: handles persistent connections over SSH/SFTP to TV.
• Event_channel: relays asynchronous events/data streams to front end.
d. External Systems / Resources
• Target webOS TV devices (SSH, SFTP, Luna API).
• Local File System (for file transfers).
• Local OS (for spawning CLI tools, e.g., ares-cli compatibility).
• Fastlane (for mobile code signing / packaging tasks, if used).
e. Build & Deployment
• angular.json, tsconfig: front-end build config.
• Cargo.toml, build.rs: Rust build config.
• fastlane folder: scripts for packaging on iOS/Android (if relevant).
• GitHub workflows & release scripts.
Relationships and Data Flows
• UI → Tauri.invoke(“device_add”, params) → Rust plugin (device.rs) → Conn_pool → SSH to TV.
• UI → Tauri.invoke(“file_list”, path) → Rust plugin (remote_files) → SFTP to TV → returns file list → UI.
• UI → Tauri.invoke(“spawn_shell”, cmd) → spawn_manager → child process / pty → streams back to UI via event_channel.
• UI listens on event_channel for streaming logs, file-transfer progress, terminal data.
• Rust managers coordinate sessions, token handling, and permission grants (via permissions/*.toml).
Architectural Patterns & Principles
• Separation of Concerns: UI layer (Angular) vs. Native layer (Rust).
• Modular Plugins: each capability (device, file, shell) is isolated as a Tauri plugin.
• Connection Pooling & Session Management: reuse SSH/SFTP sessions across UI requests.
• Reactive Event Handling: event_channel provides streaming/evented updates to the UI.
Technologies & Frameworks to Annotate
• Angular (TypeScript, Components, Services, RxJS).
• Tauri (Rust + WebView2 / WebKit).
• Rust (tokio, ssh2, sftp, serde, toml).
• SSH/SFTP (libssh2 via ssh2 crate).
• Fastlane (Ruby scripts for code signing).
• GitHub Actions (CI/CD workflows).