docs: add mdBook documentation site#22
Merged
Merged
Conversation
- book.toml with navy/ayu theme, fold enabled, build-dir = book/html - 15 pages covering introduction, installation, usage, architecture (overview, concurrency, UI/rendering, fuzzy search), all four backends (pacman, AUR/yay, APT, Homebrew), adding a new backend guide, configuration, contributing, coding guidelines, and roadmap - .github/workflows/docs.yml deploys to GitHub Pages on push to docs/mdbook branch Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an mdBook-based documentation site to the TRX repository, including initial user/architecture/backend docs plus GitHub Pages deployment via GitHub Actions.
Changes:
- Introduces a new mdBook site under
book/src/with a structured SUMMARY and multiple docs pages. - Adds mdBook configuration (
book.toml) and ignores the generated build output (book/html). - Adds a GitHub Actions workflow to build and deploy the mdBook site to GitHub Pages.
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 22 comments.
Show a summary per file
| File | Description |
|---|---|
| book/src/SUMMARY.md | Defines the mdBook navigation structure. |
| book/src/introduction.md | Adds product overview, highlights, supported platforms, and quick links. |
| book/src/installation.md | Documents installation methods and self-update behavior. |
| book/src/usage.md | Documents TUI usage, tabs, keybindings, and CLI flags. |
| book/src/configuration.md | Documents config file location and options. |
| book/src/roadmap.md | Adds a roadmap page for planned/in-progress/completed features. |
| book/src/contributing/index.md | Adds contributing quickstart and PR workflow. |
| book/src/contributing/coding-guidelines.md | Adds coding guidelines and conventions for contributors. |
| book/src/architecture/overview.md | Describes module layout and runtime flow. |
| book/src/architecture/concurrency.md | Documents thread/channel model and debounce/search flow. |
| book/src/architecture/ui-rendering.md | Documents UI layout/rendering and help overlay behavior. |
| book/src/architecture/fuzzy-search.md | Documents fuzzy matcher API and scoring approach. |
| book/src/backends/index.md | Documents PackageManager trait and backend architecture. |
| book/src/backends/pacman.md | Documents Pacman/Arch backend behavior and commands. |
| book/src/backends/aur-yay.md | Documents AUR backend behavior and provider routing. |
| book/src/backends/apt.md | Documents APT backend behavior and commands. |
| book/src/backends/homebrew.md | Documents Homebrew backend behavior and commands. |
| book/src/backends/new-backend.md | Provides a guide/skeleton for adding a new backend. |
| book.toml | Configures mdBook build output + HTML settings (themes, repo links, site-url). |
| .gitignore | Ignores mdBook build output directory (book/html). |
| .github/workflows/docs.yml | Adds CI workflow to build and deploy mdBook output to GitHub Pages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+15
to
+21
| TRX has three tabs, cycled with `Tab` / `Shift+Tab`: | ||
|
|
||
| | Tab | Description | | ||
| |-----|-------------| | ||
| | **Search** | Fuzzy-search all available packages | | ||
| | **Installed** | Browse packages currently installed on the system | | ||
| | **Updates** | Packages with a newer version available | |
| | `Tab` | Switch to next tab | | ||
| | `Shift+Tab` | Switch to previous tab | | ||
| | `?` | Toggle help overlay | | ||
| | `q` / `Esc` | Quit TRX (or exit current mode) | |
| ## Workflow Example | ||
|
|
||
| 1. Press `e` to enter search mode. | ||
| 2. Type a package name (e.g. `ripgrep`). Results appear within **50 ms** as you type. |
| curl -fsSL https://trx.pidev.tech/install.sh | sh | ||
| ``` | ||
|
|
||
| This script detects your OS and architecture, downloads the appropriate pre-built binary from GitHub Releases, and places it in `/usr/local/bin`. |
|
|
||
| ## Self-updating | ||
|
|
||
| TRX checks the [GitHub Releases API](https://api.github.com/repos/pie-314/trx/releases/latest) on every startup. If a newer version is found, it downloads and replaces the running binary automatically, then exits with a prompt to restart. |
Comment on lines
+23
to
+40
| User types a character | ||
| │ | ||
| (50 ms debounce) | ||
| │ | ||
| App spawns OS thread | ||
| │ | ||
| ▼ | ||
| PackageManager::search(&query) ← runs system command, parses output, scores results | ||
| │ | ||
| result_tx.send((query, packages)) | ||
| │ | ||
| Main loop: result_rx.try_recv() | ||
| │ | ||
| App updates packages list + triggers details fetch | ||
| ``` | ||
|
|
||
| The **50 ms debounce** is implemented in `input.rs` / `app.rs`: `last_input_time` is refreshed on every keystroke. `check_and_execute_search` is called each frame and only fires a thread when `Instant::now() - last_input_time >= 50ms` and the query has changed. | ||
|
|
|
|
||
| The split between the list and details panel is **responsive**: | ||
| - Terminal width ≥ 100 columns → 50 / 50 horizontal split | ||
| - Terminal width < 100 columns → 60 / 40 split (still horizontal but tighter) |
Comment on lines
+69
to
+70
| - **Minimal redraws** — the event loop uses a short poll timeout (not a busy-wait), so frames are only rendered when there is user input or a channel message. | ||
| - **No double-buffer diffing overhead** — ratatui handles diffing internally; TRX simply calls `terminal.draw(|frame| draw_ui(frame, app))` each iteration. |
Comment on lines
+138
to
+160
| In `src/managers/mod.rs`, add a detection branch in `get_system_manager`: | ||
|
|
||
| ```rust | ||
| pub fn get_system_manager(config: &crate::config::Config) -> Box<dyn PackageManager> { | ||
| if std::env::consts::OS == "macos" { | ||
| return Box::new(brew::BrewManager); | ||
| } | ||
|
|
||
| if std::process::Command::new("pacman").arg("--version").output().is_ok() { | ||
| return Box::new(arch::ArchManager::new(config.aur_helper.clone())); | ||
| } | ||
|
|
||
| if std::process::Command::new("apt").arg("--version").output().is_ok() { | ||
| return Box::new(apt::AptManager); | ||
| } | ||
|
|
||
| // Add your backend here: | ||
| if std::process::Command::new("dnf").arg("--version").output().is_ok() { | ||
| return Box::new(dnf::DnfManager); | ||
| } | ||
|
|
||
| Box::new(arch::ArchManager::new(config.aur_helper.clone())) | ||
| } |
Comment on lines
+30
to
+31
| curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz \ | ||
| | tar -xz --directory /usr/local/bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a full mdBook documentation site for TRX, built from source in
book/src/and output tobook/html/.What's included
Pages (15 total)
Infrastructure
book.toml— mdBook config (navy/ayu theme, collapsible sidebar, links back to GitHub source).github/workflows/docs.yml— CI/CD pipeline that builds and deploys to GitHub Pages on every push to this branch that touchesbook/orbook.tomlbook/htmladded to.gitignore(build artefacts excluded)How to enable GitHub Pages
book/on this branch — the workflow deploys automaticallyHow to build locally
Checklist
mdbook buildpasses cleanlymain(v0.1.10)