p.enthalabs

GitHub - utkarsh261/pho: TUI for Github Pull Requests

![Image 1: image](https://private-user-images.githubusercontent.com/44971195/591256490-a29b5502-f081-4b06-ae8e-0ef97fbf9028.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTMzNDYxMDcsIm5iZiI6MTc5MzM0NTgwNywicGF0aCI6Ii80NDk3MTE5NS81OTEyNTY0OTAtYTI5YjU1MDItZjA4MS00YjA2LWFlOGUtMGVmOTdmYmY5MDI4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjEwMzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMDMwVDA3MzY0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTEyMTcxMmIxOGM3ZWM0MjYyZmVkNmZlNGM4M2RhMjdhNjk2YzY5ODBjYTNkNGI2NGJmMTBhYzk1MzM2NmFlODMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.WH7H7zlDPnBiYhdTWQm09PmqgPN7Fj5N5YE7Mprlenc)

A TUI for GitHub pull requests.

![Image 2: readme-dashboard](https://private-user-images.githubusercontent.com/44971195/665890517-5fdade54-6e16-4c7f-9819-1e5bc8884fdc.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTMzNDYxMDcsIm5iZiI6MTc5MzM0NTgwNywicGF0aCI6Ii80NDk3MTE5NS82NjU4OTA1MTctNWZkYWRlNTQtNmUxNi00YzdmLTk4MTktMWU1YmM4ODg0ZmRjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjEwMzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMDMwVDA3MzY0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1ZjNiZWJkZDQ2ZGRkZDIxZDVjYmM2MmZjNWEyNTllNmFjZjU2ZmNkYWQxMjQ5YmQ1M2YzZmFiNjI2NzQ0ZWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.iucOeVaGojMZwXMwddBuP0eU8oJG-ZTECVWx2REsQQE)

Features

[](https://github.com/utkarsh261/pho#features)

- **Dashboard** - Auto-discovers repos, lists PRs across _My PRs_, _Needs Review_, _Involving_, _All_ (open PRs, loaded as you scroll), and _Recent_ tabs with a live preview pane.

- **Jump to repo/PR** - `Ctrl+P` to fuzzy-find and jump to any PR; inside a PR, `Ctrl+P` jumps to any file in its diff.

- **Open a PR directly** - `pho pr 123` to launch straight into a PR's detail view.

- **PR detail** - Browse description, diff, comments, and commits. Sidebar for files and CI checks.

- **Stacked PRs** - PRs built on another open PR's branch, and GitHub's native stacks, are listed together with a rail joining them, and the preview maps the whole stack with each PR's CI and review state. In a PR, `{`/`}` step down/up the stack on the same tab and `S` lists it.

- **CI logs** - `Enter` on a GitHub Actions check shows the end of its job log with error lines highlighted; `n`/`N` jumps between errors and `r` re-runs the job.

- **Diff navigation** - Line-by-line cursor, `gg`/`G`, `Ctrl+d`/`Ctrl+u`, visual mode for selecting ranges.

- **Inline reviews** - Draft inline comments on diff lines, edit, discard, and batch-submit with a review event. Just like Github web UI.

- **Comments & approvals** - Post top-level comments, review comments, or approve directly.

- **PR actions** - Edit title/body, merge (with method selection), close/reopen, and checkout the branch locally.

- **Commit view** - Inspect individual commits and their diffs.

- **Search** - `/` to search within diffs and descriptions; `n`/`N` to jump between matches.

- **Themes** - Catppuccin Mocha, Tokyo Night, Gruvbox, Nord, Dracula and Rosé Pine. Press `T` to preview them live.

- Works with Github Enterprise as well.

Install

[](https://github.com/utkarsh261/pho#install) With Homebrew (macOS and Linux):

``` brew install utkarsh261/tap/pho ```

Or with Go:

``` go install github.com/utkarsh261/pho/cmd/pho@latest ```

Binary lands in `$(go env GOPATH)/bin/pho`. To pin a version, swap `@latest` for a tag from the releases page, e.g. `@v0.1.49`.

Add it to the `$PATH`:

``` echo 'export PATH="$(go env GOPATH)/bin:$PATH"' >> ~/.zshrc ```

Requirements

[](https://github.com/utkarsh261/pho#requirements)

- Git

- GitHub CLI (`gh`), logged in with `gh auth login`. pho reuses its token, including for GitHub Enterprise hosts.

- Go 1.25+, only if you install with `go install` or build from source

Usage

[](https://github.com/utkarsh261/pho#usage) pho looks at the current directory and its direct children for git repos with a GitHub remote. Start it in a directory holding your clones:

``` pho ```

or point it at one:

``` pho --root ~/path/to/dir/containing/all/cloned/repositories ```

To open a pull request straight in its detail view:

``` pho pr 123 ```

Flags work before or after `pr <number>`:

| Flag | Description | | --- | --- | | `--root <dir>` | Directory to scan for git repos (default `.`) | | `--theme <name>` | Theme for this run, overriding the config file | | `--config <path>` | Config file to use (default `~/.config/pho/config.toml`) | | `--debug` | Log at debug level (also `PHO_DEBUG=1`) | | `--reset` | Clear the SQLite and repo discovery caches before starting | | `--version` | Print the version and exit | | `--changelog` | Print the latest release notes and exit |

Configuration

[](https://github.com/utkarsh261/pho#configuration) pho reads `$XDG_CONFIG_HOME/pho/config.toml`, which defaults to `~/.config/pho/config.toml`. It runs fine without one. Every key is optional; the values below are the defaults.

[repos] pin = [] # "owner/repo" entries to list first exclude = [] # "owner/repo" entries to hide

[dashboard] max_prs = 300 # open PRs the All tab loads at most group_stacks = true # list a stack's PRs together, top of the stack first

[palette] max_prs = 300 # PRs the Ctrl+P jump list holds

[diff] collapse_lines = 1000 # files with more changed lines start collapsed collapse_line_width = 5000 # so do files with a line longer than this max_lines = 5000 # files past this can only be opened on GitHub max_line_width = 20000 # same, for line length row_budget = 20000 # past this many diff rows, the largest files collapse

[ui] theme = "pho-default" # see Themes below background = "theme" # or "terminal"

[cache] dir = "~/.cache/pho" # where cache.db lives max_memory_mb = 16 # in-memory cache size

[logging] file = "~/.local/state/pho/debug.log" level = "info" # debug, info, warn or error

[updates] whats_new = true # mention a new version in the status bar after an upgrade check = true # look for a newer release once a day

What's new

[](https://github.com/utkarsh261/pho#whats-new) After you upgrade, the dashboard's status bar says so for a few launches. Press `W` on the dashboard to read the release notes, at any time. `pho --changelog` prints them in the terminal.

Once a day pho also checks whether a newer release is out and, if so, says so in the dashboard's status bar. If you installed with Homebrew, press `U` there and confirm with `Enter` to run `brew upgrade utkarsh261/tap/pho` without leaving pho; restart pho afterwards to use the new version.

pho talks to GitHub's public API for both, without your token. Set `[updates] whats_new = false` or `[updates] check = false` to turn either off, or `PHO_NO_UPDATE_CHECK=1` for both; `W` and `--changelog` still work. pho remembers the last version you saw and the last check in `~/.local/state/pho/state.json`.

Themes

[](https://github.com/utkarsh261/pho#themes)![Image 3: pho-themes](https://private-user-images.githubusercontent.com/44971195/673728263-7d452bdc-015c-43b3-bcaf-cd24e83f562c.gif?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTMzNDYxMDcsIm5iZiI6MTc5MzM0NTgwNywicGF0aCI6Ii80NDk3MTE5NS82NzM3MjgyNjMtN2Q0NTJiZGMtMDE1Yy00M2IzLWJjYWYtY2QyNGU4M2Y1NjJjLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjEwMzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMDMwVDA3MzY0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRiODBhZjcyOGFkNDE3NWQ0YzE1Y2FjODMwZDA4NzdiYTNhMTZkYmMxYTU3MGU0MGJhNDNkMGQ0NTA1NTk3NTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRmdpZiJ9.f0xTLcHaGgXIjg-cMnZBtCOQbUqm17fQS1wHAT9CqsE) Press `T` anywhere to open the theme picker. Arrowing through it repaints the screen with each theme; `Enter` keeps one and saves it to your config, `Esc` puts the old one back. You can also set it in the config:

[ui] theme = "catppuccin-mocha" # pho-default (the default), catppuccin-mocha, tokyo-night,

gruvbox-dark, nord, dracula, rose-pine

background = "theme" # or "terminal" to keep your terminal's own background

or for one run with `pho --theme nord`.

Themes paint their own background so text stays readable whatever your terminal is set to. With `background = "terminal"` (handy for transparent terminals) contrast is only guaranteed when your terminal background matches the theme's. Colours are checked for contrast on truecolor and 256-colour terminals; on 16-colour terminals the cursor row switches to reverse video.

Logs

[](https://github.com/utkarsh261/pho#logs)

``` tail -f ~/.local/state/pho/debug.log ```

Development

[](https://github.com/utkarsh261/pho#development)

``` just build # go build -o pho ./cmd/pho just test # go test ./... just test-race # go test -race -count=1 ./... just vet # go vet ./... ```

Why

[](https://github.com/utkarsh261/pho#why) So that i can build it exactly how i want a tool which i use on a regular basis to be.