Skip to content

docs: add mdBook documentation site#22

Merged
pie-314 merged 1 commit into
mainfrom
docs/mdbook
May 16, 2026
Merged

docs: add mdBook documentation site#22
pie-314 merged 1 commit into
mainfrom
docs/mdbook

Conversation

@yashksaini-coder

Copy link
Copy Markdown
Collaborator

Summary

Adds a full mdBook documentation site for TRX, built from source in book/src/ and output to book/html/.


What's included

Pages (15 total)

Section Pages
Getting Started Introduction, Installation, Usage
Architecture Overview, Concurrency Model, UI & Rendering, Fuzzy Search Engine
Backends Overview & trait reference, Pacman, AUR/yay, APT, Homebrew, Adding a New Backend
Configuration Config file reference
Contributing Contributing Guide, Coding Guidelines
Roadmap Feature roadmap

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 touches book/ or book.toml
  • book/html added to .gitignore (build artefacts excluded)

How to enable GitHub Pages

  1. Go to Settings → Pages
  2. Set Source to GitHub Actions
  3. Push any change to book/ on this branch — the workflow deploys automatically

How to build locally

cargo install mdbook   # one-time
mdbook build           # outputs to book/html/
mdbook serve           # live-reload preview at http://localhost:3000

Checklist

  • mdbook build passes cleanly
  • Branch rebased on top of main (v0.1.10)
  • Build artefacts gitignored
  • GitHub Actions workflow wired up for Pages deployment

- 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>
Copilot AI review requested due to automatic review settings May 16, 2026 12:46
@vercel

vercel Bot commented May 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
trx Ready Ready Preview, Comment May 16, 2026 0:46am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread book/src/usage.md
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 |
Comment thread book/src/usage.md
| `Tab` | Switch to next tab |
| `Shift+Tab` | Switch to previous tab |
| `?` | Toggle help overlay |
| `q` / `Esc` | Quit TRX (or exit current mode) |
Comment thread book/src/usage.md
## 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.
Comment thread book/src/installation.md
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`.
Comment thread book/src/installation.md

## 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

@pie-314 pie-314 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pie-314 pie-314 merged commit 6337867 into main May 16, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants