Show HN: Whetuu – a zero-config cross-shell prompt written in Zig
Whetuu: A Zero-Config, Cross-Shell Prompt in Zig
whetū /ˈfɛ.tuː/ — derived from the Māori word for "star" — is an opinionated, zero-configuration prompt designed to work across multiple shells, engineered entirely in the Zig language.
The core philosophy is simplicity: a single compiled binary produces one curated prompt experience that is identical for every user.
There are
no configuration files, no themes to tweak, and no parameters to tune.
It is compatible with fish, bash, and zsh, boasting a render speed of approximately .
🚀 Installation
Getting started requires only a single command for macOS and Linux users.
- Detects host platform
- Verifies download via
SHA256SUMS - Installs binary to
~/.whetuu/bin - Appends two lines to your active shell configuration
curl --proto '=https' --tlsv1.2 -fsSL https://yamafaktory.github.io/whetuu/install.sh | sh
Alternative Setup Methods
- Dry Run: Execute the installer with
WHETUU_NO_MODIFY=1to see the required config lines without applying them. - Manual Init: Run
whetuu init <shell>to generate the integration script and identify the target config file.
🎨 Prompt Anatomy
The prompt utilizes Nerd Font glyphs for language logos, git branches, and the primary prompt character. Segments are dynamic; they only appear when relevant.
Segment Details
| Segment | Description | Visual Nuance |
|---|---|---|
user_host | user@host | Bold Green normally; Bold Red for root or SSH sessions. |
directory | Current path | Shows the anchor and as many trailing folders as the width allows. |
git branch | Current branch | Magenta text with a branch glyph; shows (detached) if applicable. |
git state | Active operations | Yellow text for (rebasing 2/7), (merging), or (cherry-picking). |
git status | Repo health | A bracketed group: [conflicts, stashes, staged, modified, untracked, ahead, behind]. |
language | Toolchain version | Brand-colored logo and version for 39 different tools/languages. |
cmd_duration | Execution time | Timer glyph appears if the last command took . |
character | The prompt end | A purple star (or the current language's brand color). |
🔍 The History Picker
By pressing the Up Arrow, users access a sophisticated history picker. To keep the list clean, only commands that exited successfully are recorded.
Features
- Context Awareness: Defaults to the current directory's history, falling back to global history if the local list is empty.
- Visuals: Rows feature syntax highlighting. Colors for flags, paths, and operators are pulled from your existing terminal theme.
- Smart Truncation: Long commands are truncated in the middle (using
…) rather than the end, ensuring unique prefixes remain visible.
Picker Controls
Ctrl+G: Toggle between directory-specific and global history.Tab: Copy the current selection into the search bar for editing.Esc: Cancel and return to the command line.
🛠️ Command Reference
While the shell hook handles most tasks, whetuu provides a few manual commands:
whetuu init fish|bash|zsh: Outputs the integration script forevalorsource.whetuu paths: Displays the locations of the version cache and history store.
Note:
whetuu pathswill explicitly mark missing files rather than hiding them until the first command is cached/recorded. It requires$HOMEor XDG variables to be set to function.
⚡ Performance
Because a prompt runs before every single command, speed is critical. Whetuu achieves its render time by using std.Io to run all disk-reading modules concurrently.
Benchmarks
Measured with hyperfine on an i9-13900H (ReleaseFast).
| Scenario | Total Render Time | Bottleneck |
|---|---|---|
| No repo / No toolchain | N/A | |
| Zig repo (35 files) | Zig version probe () | |
| Monorepo (8259 files) | Git status () |
Worst-Case Scenario: If git hangs for 30 seconds, the prompt will still return in approximately due to the concurrent execution of the toolchain probe () and git ().
🛡️ Security & Privacy
Since a prompt has visibility into every command, Whetuu is designed with a strict security posture:
- Zero Networking: The binary contains no HTTP clients, sockets, or synchronization logic.
- Strict Permissions: The history store is created with
mode 600and reset to this on every write. - XDG Compliance: Data is stored in
~/.cache/whetuu/versionsand other XDG-compliant paths, separate from the installation directory. - Easy Removal: Running
rm -rf ~/.whetuuremoves the application without deleting your history. - Privacy Mode: Starting any command with a leading space prevents it from being recorded in the history.
Subprocess Logic: Whetuu only ever spawns two types of subprocesses: git and the specific toolchain version probe.