Whetuu: A Zero-Config Cross-Shell Prompt and History Picker

Whetuu: A Zero-Config Cross-Shell Prompt and History Picker

Whetuu is a zero-config, opinionated status line and history picker for fish, bash, and zsh, written in Zig. It provides a high-performance, cross-shell prompt that tracks git status, toolchain versions, and command duration, while integrating an interactive history picker bound to the up arrow.

High-Performance Prompt Rendering

Whetuu is designed for minimal latency to ensure the shell remains responsive. It utilizes std.Io to run disk-reading modules concurrently, meaning the render time is determined by the slowest single probe rather than the sum of all probes.

Performance benchmarks on a 13th gen i9-13900H (ReleaseFast) show:

  • No repo, no toolchain: 2.3 ms
  • Zig repo (35 files): 3.0 ms
  • Monorepo (8259 files): 20.2 ms

To prevent shell hangs in slow repositories, Whetuu implements strict timeouts: git subprocesses are bounded to 250 ms and toolchain probes are bounded to 200 ms. If a process exceeds these limits, the prompt simply drops the git segment for that render.

Integrated History Picker

Unlike traditional shell history, Whetuu includes a history picker triggered by the up arrow. This picker is scoped to the current directory by default, falling back to global history when no directory-specific history exists.

Key features of the history picker include:

  • Clean History: Only commands that exit cleanly are recorded, preventing typos from cluttering the list.
  • Syntax Highlighting: The picker uses the terminal theme's palette for command names, flags, paths, and operators.
  • Smart Filtering: Filtering is case-insensitive and requires every word to match.
  • Directory Scoping: Users can switch between directory-specific and global history using Ctrl+G.

Toolchain and Git Status Tracking

The prompt consists of several dynamic segments that appear only when relevant:

  • User/Host: Displayed in bold green (or bold red for root/SSH) only when applicable.
  • Directory: Collapses $HOME to ~ and anchors the path to fit the window width. -- Git Branch: Shows the current branch or (detached) in magenta.
  • Git State: Displays active operations like rebasing, merging, or cherry-picking by reading directly from .git without subprocesses.
  • Git Status: Grouped indicators for conflicts, stashes, staged, modified, and untracked files.
  • Language/Toolchain: Displays the logo and version for 39 supported languages and tools, detected via project manifests or source file extensions.
  • Command Duration: A timer glyph appears if the last command ran for two seconds or more.

Security and Privacy

Whetuu Whetuu avoids network access and telemetry. The binary contains no HTTP client or sockets, ensuring no data leaves the machine.

Data is stored in two XDG-compliant files: a history store (mode 600) and a toolchain version cache (~/.cache/whetuu/versions). Removing the tool is via rm -rf ~/.whetuu and removing the integration lines from shell config files.

To protect against malicious repositories, Whetuu defangs control bytes in branch names or directories, replacing them with ? to prevent terminal repainting or cursor movement. Additionally, while the language module probes the toolchain by running version commands (e.g., node --version), it only executes binaries resolved via the user's PATH, never binaries within the repository itself.

Installation and Requirements

Installation is performed via a single command: curl --proto '=https' --tlsv1.2 -fsSL https://yamafaktory.github.io/whetuu/install.sh | sh

Users who prefer manual configuration can use WHETUU_NO_MODIFY=1 to print the integration lines instead of modifying shell configs.

Requirement: A Nerd Font is required to render the glyphs for git branches, language logos, and the prompt character.

Community Feedback

While praised as a "non-rust alternative to starship," some users expressed concerns regarding the "opinionated" nature of the tool, specifically the integration of shell history management.

"I don’t want my prompt to also handle shell history, and especially in such an “opinionated” way."

In response to these updates, the author updated the documentation to explicitly label Whetuu as an "opinionated, zero-config status line and history picker."

Sources