1.9 KiB
1.9 KiB
TUI Resource Monitor Plan
Language Choice: Rust
Why Rust for this:
- Produces a single static-ish native binary easily (great for self-contained executables).
- Strong ecosystem for TUIs (
ratatui,crossterm) and system stats (sysinfo). - Good performance and low runtime overhead for frequent refresh loops.
Plan
- Define scope and MVP metrics
- CPU usage (total + per core), memory, swap, disk usage, network throughput, process count, uptime.
- Target Linux first (then add macOS/Windows support if needed).
- Bootstrap project structure
- Create a Rust CLI app with modules for
collectors,ui,state, andconfig. - Add dependencies:
ratatui,crossterm,sysinfo,anyhow,clap,serde(optional config).
- Implement data collection layer
- Build a polling engine (e.g., 500ms–1s interval) that samples resource metrics.
- Normalize all values into a shared state model for UI rendering.
- Add delta-based metrics (network/disk rates) from successive samples.
- Build TUI layout and rendering
- Header: host info, uptime, refresh rate.
- Main panes: CPU, memory/swap, disk, network.
- Footer/help bar with keybindings.
- Add responsive layout for small terminal sizes.
- Add interaction model
- Keybindings: quit, pause/resume, change refresh interval, toggle detailed view.
- Optional sorting/filtering for top processes view.
- Packaging and self-contained build
- Configure release profile (
lto,panic=abort,strip) for small fast binary. - Document build command for optimized executable.
- Optional: static linking strategy for fully portable Linux binary.
- Quality gates
- Unit tests for metric calculations and rate/delta logic.
- Smoke test for startup/render loop.
- Run
clippyandfmtchecks.
- Delivery
- Provide binary + README with usage, keybindings, and supported platforms.
- Include known limitations and next-step roadmap (alerts, historical sparklines, per-process drilldown).