This repository is a small Rust TUI for the Windows Package Manager (winget).
It is keyboard-first, async, and intentionally lightweight.
src/
main.rs startup/shutdown and terminal lifecycle
app.rs App state, async coordination, selection, sorting, scrolling
backend.rs WingetBackend trait
cli_backend.rs winget CLI parsing and command execution
config.rs optional startup defaults from config.toml
handler.rs keyboard and mouse event routing
models.rs Package, PackageDetail, Operation, sorting enums
theme.rs semantic colors and UI styles
ui.rs all ratatui rendering
Appis the central state container.AppModeswitches betweenSearch,Installed, andUpgrades.FocusZoneswitches keyboard focus between the package list and detail panel.InputModedistinguishes normal navigation from search or version-entry prompts.- Background work returns via
AppMessageover a Tokio unbounded channel.
The app uses generation counters to discard stale async responses when the user switches views or changes selection quickly. Preserve that pattern when adding new background loads.
cli_backend.rsis locale-aware; avoid hard-coding English-only assumptions.- Keep using the existing helpers for column detection, footer detection, normalization, and sanitization.
- Package IDs ending with
...or…are considered truncated and should not be used with exact winget detail/install flows.
- Prefer semantic helpers from
theme.rsover hard-coded colors. - Use Unicode display width helpers in
ui.rswhen truncating or aligning text. - The detail pane and list pane both maintain scroll/focus state; avoid changes that break keyboard navigation consistency.
Optional config file:
- Windows:
%APPDATA%\winget-tui\config.toml - Fallback for non-Windows/dev:
$HOME/.config/winget-tui/config.toml
Supported keys:
default_view = "installed" # installed | search | upgrades
default_source = "all" # all | winget | msstoreLeft/Right: switch viewsTab/Shift+Tab: toggle focus between list and details/ors: focus searchf: cycle source filteri: installI: install a specific versionu: upgradex: uninstallSpace,a,U: multi-select and batch upgrade in Upgrades viewo: open homepagec: open changelog / release notesS: cycle sorting?: help
Use the same commands as CI:
cargo check --all-targets
cargo fmt -- --check
cargo test
cargo clippy -- -D warningsThe integration test in tests\parse_test.rs is Windows-only; Linux CI still
builds and runs the rest of the suite.
- Keep changes small and behavior-safe.
- Add tests when adjusting parser logic, selection behavior, or input handling.
- Avoid new dependencies unless there is a clear payoff.