<div align="center">
# haj
[](https://aur.archlinux.org/packages/haj)
[](https://crates.io/crates/haj)
[](https://www.rust-lang.org/)
**the beautiful, cross-distro package manager and tui.**
*(and yes, it is named after the ikea shark. all hail blahaj. 🦈)*
</div>
`haj` is a modern, memory-safe cross-distro package manager wrapper and tui written in rust. It replaces noisy terminal output with the clean, minimalistic aesthetic of tools like `cargo` and `bun`, without compromising on speed or safety. also comes with love from the supreme plushie shark.
supports:
- **`pacman` + aur** (arch, artix, endeavourOS, garuda, manjaro, cachyOS, blahArch, etc.) — optional native `libalpm` bindings or pure-cli fallback (`--no-default-features`). *(primary, tested backend)*
todo / working on:
- **`apt` / `dpkg`** (debian, ubuntu, pop!_OS, linux mint, etc.) — **work in progress** *(experimental / incomplete, not yet tested end-to-end)*.
- **`dnf5` / `dnf4` / `rpm`** (fedora, rhel-alikes, nobara, etc.) — **work in progress** *(experimental / incomplete, not yet tested end-to-end)*.
<img alt="haj demo" src="assets/cli-demo.gif" width="100%" />
## features
### the tui dashboard
`haj` now features a ridiculously-fast, interactive tui powered by `ratatui`. run `haj tui` to access:
<img alt="haj tui demo" src="assets/tui-dem0.gif" width="100%" />
* **the ultimate package browser:** a beautiful, responsive explorer. search live, cycle filters with `tab` (aur, installed, updates, repos), and press `1-4` to seamlessly lazy-load rich package overviews, dependency trees, and installed file paths without ever freezing the ui.
* **smart batch queueing:** press `space` to toggle packages and build a virtual install/remove queue, keeping memory usage minimal even with 100,000+ aur packages loaded.
* **transaction history & groups:** press `h` to browse your parsed package transaction history (what upgraded, what failed, and when), or `g` to quickly explore and install package groups (supported on `pacman`; experimental `dnf` support is wip).
* **the orphan sweeper & cache manager:** hit `o` on the dashboard to instantly detect and vaporize unneeded dependencies, or `c` to clean your package cache natively.
* **live commands popups:** haj streams live `pacman` (and wip `apt`/`dnf`) execution logs directly into floating, minimalist ui panels with progress indicators and concise status without the wall of noise.
* **system statistics:** press `t` for a cozy dashboard tracking your explicit packages, dependency splits, disk usage, cache size, last sync time, and system health at a glance.
* **3d rotating blahaj (best):** a fully 3D, spinning ascii art shark rendered natively via [display3d](https://github.com/renpenguin/display3d).
### cli highlights
- **native package browser:** browse repositories, inspect dependencies, installed files, package metadata and groups entirely inside the tui with asynchronous lazy loading.
- **interactive search-install:** type a naked query (e.g., `haj discord`) to display a numbered table of matching packages (`--aur` / `--repo` on pacman distros). Select numbers (e.g., `1 3`) to queue them instantly.
- **aur PKGBUILD auditing:** press `v` during the aur pre-transaction prompt to inspect the live `PKGBUILD` via a fast shallow clone, opens right inside your default text editor like neovim.
- **arch news & atomic upgrade guard:** on arch systems, `haj upgrade` / `haj jump` checks updates safely without mutating sync databases (`checkupdates`), warns via the official Arch rss feed if recent posts require manual intervention, and upgrades atomically via `pacman -Syu`.
- **system overview (`stats`):** a clean status dashboard tracking package counts, explicit vs. dependency splits, cache sizes, update counts, and system health at a glance.
- **the cargo/bun aesthetic:** no more jagged progress bars or walls of text. `haj` parses native output streams in real-time, displaying a single, elegant progress spinner and clean transaction summaries.
- **pure-rust portability:** builds out of the box with `rustls` (no OpenSSL dependency) and `--no-default-features` anywhere on linux without `libalpm`.
## how it works
`haj` auto-detects the active backend (`pacman` is tested and ready; `apt` and `dnf` backends are still under active development and considered experimental):
1. **reads** (`search`, `show`, `orphan`, `list`) use `libalpm` directly on `pacman` systems when enabled, or `pacman` cli fallback (experimental `apt-cache`/`dpkg-query` and `dnf repoquery`/`rpm` adapters are still wip).
2. **writes** (`install`, `remove`, `update`, `clean`) hand off securely to standard system subprocesses (`pacman`, with experimental `apt-get`/`dnf` support in progress) with lazy privilege escalation (`sudo`, `doas`, `run0`, or `pkexec`) only when a write operation executes.
## installation
### aur
you can install [haj](https://aur.archlinux.org/packages/haj) using your favorite aur helper:
```bash
yay -S haj
# or
paru -S haj
```
### nix
install or run `haj` directly with nix flakes (builds with pure-cli fallback by default to avoid `libalpm` version skew):
```bash
# run once without installing
nix run github:asitos/haj
# install into your nix profile
nix profile install github:asitos/haj
# optional: opt into libalpm bindings
nix profile install github:asitos/haj#haj-alpm
```
or add it to a flake config:
```nix
inputs.haj.url = "github:asitos/haj";
# add inputs.haj.packages.${pkgs.stdenv.hostPlatform.system}.default to packages
```
### cargo
requires [rust + cargo](https://www.rust-lang.org/tools/install) to be installed:
```bash
cargo install display3d
cargo install haj
```
### from source
requires the rust toolchain (`cargo`).
```bash
git clone https://github.com/asitos/haj.git
cd haj
./install.sh
```
the install script builds `haj` in release mode, auto-detects `libalpm` (falling back to `--no-default-features` when unavailable), and installs the binary, man page (`man haj`), and shell completions to `/usr/local`.
useful flags:
```bash
# also install optional 3d rotating shark renderer
./install.sh --with-display3d
# build without libalpm bindings
./install.sh --no-alpm
# install to custom prefix (e.g. ~/.local without sudo)
./install.sh --prefix ~/.local
# uninstall haj binary and completions
./install.sh --uninstall
```
### pacman (blaharch-repo)
install `haj` from the [official blahArch repo](https://asitos.github.io/blaharch-repo/) for future updates through `pacman`,
add this to the bottom of your `/etc/pacman.conf`:
```bash
[blaharch]
SigLevel = Optional TrustAll
Server = https://asitos.github.io/blaharch-repo/$arch
```
then just sync and install normally (or update `haj` if it is already installed):
```bash
sudo pacman -Syu haj
```
### prebuilt release archive
download the latest release archive (`haj-<version>-x86_64-linux.tar.gz`) containing `haj`, `haj.1`, and shell completions from GitHub Releases:
```bash
tar -xzf haj-<version>-x86_64-linux.tar.gz
sudo install -Dm755 haj /usr/local/bin/haj
sudo install -Dm644 haj.1 /usr/local/share/man/man1/haj.1
```
optionally install `display3d` (`cargo install display3d`) for the 3D rotating shark animation in `haj tui`.
## docker
you can run haj inside an arch linux container to safely test package operations without affecting your host system.
to build the image:
```bash
docker build -t haj .
```
to run haj:
```bash
docker run --rm -it haj --help
docker run --rm -it haj search ripgrep
docker run --rm -it haj tui
```
**warning:** haj inside docker manages the container's arch environment, not your host. do not bind-mount the host `/`, `/etc`, `/var/lib/pacman`, or the host pacman database into it. doing so will risk corrupting your host package database.
package operations performed here affect only the container. if you want to persist the container's package database and cache across runs, use named docker volumes:
```bash
docker run --rm -it \
-v haj-db:/var/lib/pacman \
-v haj-cache:/var/cache/pacman/pkg \
haj tui
```
## usage & commands
`haj` uses natural, typing-friendly verb-action syntax and short aliases across both the cli and the interactive tui.
### commands & options
| `tui` | `t` | launch the interactive package manager dashboard |
| `update` | `up`, `sync`, `refresh` | synchronize remote repositories |
| `upgrade [pkg]` | `jump` | upgrade system or specific packages (`--no-sync`) |
| `install <pkg\|file>` | `add`, `i`, `a` | install packages or local archive (`--from aur\|repo`) |
| `remove <pkg>` | `rm`, `toss`, `uninstall`, `delete`, `drop` | remove packages & unneeded dependencies |
| `search <query>` | `s`, `find` | search official repositories & aur |
| `show <pkg>` | `info`, `about`, `describe` | show detailed package information |
| `group <name>` | `g` | browse and install package groups / meta-packages |
| `list [filter]` | `ls` | list installed packages (`explicit`, `deps`, `aur`, `foreign`, `orphans`, `updates`) |
| `stats` | `st` | show system health and package statistics |
| `load <file>` | `l` | install a local package archive (`.pkg.tar.*`; wip `.deb` / `.rpm`) |
| `fetch <pkg>` | `f`, `download`, `get` | download packages without installing |
| `downgrade <pkg> [to <ver>]` | `sink`, `rollback` | downgrade an installed package |
| `owns <file>` | `ow`, `owner`, `which` | find which installed package owns a file (`who owns <path>`) |
| `files [in\|of] <pkg>` | `lf` | list files installed by a package (`list files <pkg>`) |
| `locate <query>` | `loc`, `where`, `find-file` | search repositories for a file (`pacman -F`) |
| `history` | `h` | show recent package changes (`-l <n>`) |
| `orphan` | `o`, `orphans`, `autoremove`, `prune` | detect or remove orphaned dependencies |
| `clean [cache\|orphans]` | `c` | clean package cache (`-k <n>`) or orphans |
| `mark <pkg> [as explicit\|dep]` | `m` | set or toggle a package's install reason |
| `diff` | `pn`, `pacnew`, `merge` | interactively manage and merge `.pacnew` config files |
| `pkgbuild <pkg>` | `pb` | read the `PKGBUILD` of an aur package |
- `-a`, `--aur` : restrict operations to the aur.
- `-r`, `--repo` : restrict operations to arch repositories.
- `--from <source>` : restrict operations to `aur` or `repo`.
- `-y`, `--noconfirm` : bypass all confirmation prompts.
- `-n`, `--needed` : do not reinstall up-to-date packages (skips up-to-date AUR builds too).
- `-i`, `--ignore <pkg>` : ignore a package upgrade (comma-separated: pkg1,pkg2).
- `-c`, `--config <path>` : specify an alternate package manager config file (`pacman.conf`; wip `apt`/`dnf.conf`).
- `--root <path>` : specify an alternate installation root.
- `--no-sync` : do not sync package databases before upgrading (`upgrade`).
- `-v`, `--verbose` : enable verbose debug logging.
- `-d`, `--dry-run` : preview a command without modifying the system.
- `-h` / `--help` : `-h` prints concise short help; `--help` prints full reference (or run `man haj`).
- `-V`, `--version` : show version info.
### examples
launch the interactive dashboard:
```bash
haj tui
# or
haj t
```
search and install with natural syntax or short aliases:
```bash
# interactive search and install
haj discord
# search repos or aur
haj search discord
haj find foo in repo
# install from repos or aur
haj add neovim
haj add yay-bin from aur
haj i htop cmatrix
```
upgrade, inspect, and clean up naturally:
```bash
# sync and upgrade
haj sync
haj upgrade
haj upgrade --no-sync
# inspect packages, files, and ownership
haj about neovim
haj who owns /usr/bin/bash
haj list files of bash
haj list updates
haj list explicit
# manage marks, downgrades, cache, and orphans
haj mark bash as explicit
haj downgrade bash to 5.2.026-1
haj clean cache -k 2
haj clean orphans
haj prune
```
safely preview removing a package:
```bash
haj -d drop firefox
```
## shell autocompletion
`haj` supports shell autocompletion for **bash**, **zsh**, and **fish**, generated directly via `haj completions <shell>` or downloaded from release assets:
```bash
# generate directly from haj
haj completions bash > haj.bash
haj completions zsh > _haj
haj completions fish > haj.fish
# or download tarball (bash.sh, fish.sh, zsh.sh) from latest release
mkdir -p /tmp/haj-completions
---
### 1. fish setup
```bash
# system-wide (all-users)
sudo cp src/completions/fish.sh /usr/share/fish/vendor_completions.d/haj.fish
# user-only
mkdir -p ~/.config/fish/completions
cp src/completions/fish.sh ~/.config/fish/completions/haj.fish
# restart shell or run the following command
source ~/.config/fish/completions/haj.fish
```
### 2. bash setup
```bash
# system-wide (all-users)
sudo cp src/completions/bash.sh /usr/share/bash-completion/completions/haj
# user-only
mkdir -p ~/.local/share/bash-completion/completions
cp src/completions/bash.sh ~/.local/share/bash-completion/completions/haj
```
### 3. zsh setup
```bash
# user-only
mkdir -p ~/.zsh/completion
cp src/completions/zsh.sh ~/.zsh/completion/_haj
# ensure ~/.zshrc includes completion path
fpath=(~/.zsh/completion $fpath)
autoload -U compinit && compinit
# reload zsh
exec zsh
```
## configuration
`haj` works perfectly out of the box, and generates a default config file on first run at `~/.config/haj/haj.toml` (or `$XDG_CONFIG_HOME/haj/haj.toml`; legacy `config.toml` is still read if present). set `theme` to a built-in preset (`tokyo-night`, `catppuccin-mocha`, `dracula`, etc.), or set `theme = "custom"` to unlock the color keys below (ansi names, `#rrggbb` hex codes, or `0-255` indices).
```toml
# ~/.config/haj/haj.toml
# default options
[general]
animations = true
aur_only = false
repo_only = false
build_dir = "~/.cache/haj/aur"
diff_prog = "vimdiff" # diff tool for `haj diff` (`DIFFPROG` env takes precedence)
# privilege_cmd = "doas" # leave unset (or omit) to auto-detect sudo/doas/run0/pkexec
verbose = false
[colors]
# themes: default, custom, catppuccin-latte, catppuccin-frappe,
# catppuccin-macchiato, catppuccin-mocha, tokyo-night, tokyo-storm,
# dracula, nord, gruvbox-dark, gruvbox-material, onedark,
# everforest-dark, kanagawa-wave, kanagawa-dragon,
# solarized-dark, monokai, ayu, flexoki-dark
theme = "default"
# only used when theme = "custom"
# accent = "cyan"
# secondary = "magenta"
# heading = "light_magenta"
# text = "white"
# muted = "dark_gray"
# success = "green"
# warning = "yellow"
# error = "red"
# repo_core = "cyan"
# repo_extra = "green"
# repo_multilib = "yellow"
# repo_aur = "magenta"
```
## for nerds
`haj` is built with a focus on memory safety, zero-cost abstractions, and concurrent execution.
* **asynchronous stream parsing:** uses `tokio` non-blocking subprocess streams to parse and format `pacman` (plus experimental `apt` / `dnf` wip streams) output cleanly in real-time without deadlocking background workers.
* **ffi & lock safety:** utilizes `alpm.rs` (when `pacman` feature is enabled) for fast read queries against `libalpm`, drops read handles cleanly, and leaves `db.lck` management to `pacman`.
* **dag traversal:** the `orphan` detection engine completely avoids bash scripting, instead traversing the system's directed acyclic graph (dag) directly in memory via c-bindings to calculate unneeded dependencies in microseconds.
* **lazy-loaded virtual ui:** the tui package browser aggressively caches asynchronous metadata and virtualizes list rendering. this guarantees that scrolling through huge aur databases or rendering massive file trees runs at a flawless 60 fps without ever blocking the main thread.
* **fully asynchronous tui:** background workers fetch package metadata, dependency trees and installed file lists while the ui remains responsive, ensuring navigation never blocks on slow pacman queries.
## license (BORING)
GPL-3.0-or-later license. see `LICENSE` for more information.
---
made with rust, libalpm, and an unreasonable amount of love for the ikea shark.
[](https://ko-fi.com/asitos)
**haj loves you all :3**