$ show ajeetdsouza/zoxide
zoxide is a high-performance CLI tool that replaces `cd` with a smarter, learning directory jumper. It tracks directory access frequency and recency, ranks entries using a frecency algorithm, and allows instant navigation via partial keyword matching. The binary exposes subcommands for adding, querying, editing, importing, and removing entries, while shell-specific init scripts integrate hooks (prompt or PWD-based) to automatically record visited directories. Interactive selection via fzf and Space-Tab completions are supported on major shells (bash, zsh, fish, etc.). The codebase is a single Rust binary with a clean, modular architecture: a text-based database with atomic writes, a streaming query engine with lazy deletion, a trait-based import system for six external tools, and Askama-templated shell scripts. It demonstrates strong engineering practices: comprehensive CI/CD, cross-compilation for 12+ targets, shell script validation, and thorough test coverage including shell syntax checks.
The LLM identified 2 files worth highlighting for reuse:
The `Fzf` struct wraps the `fzf` binary with a builder pattern, configuring search mode, preview window, and environment variables. It spawns a child process, streams directory entries as NUL-separated records, and handles broken pipe and exit codes gracefully. This is a reusable pattern for integrating any interactive fuzzy-finder into a Rust CLI, with proper error handling and cross-platform considerations (Windows path resolution, SHELL env).
Defines an `Importer` trait with a single method `dirs()` that yields `Result<Dir, ImportError>` iterators. The `run()` function drives any importer end-to-end: iterates entries, applies exclude globs, writes to the database, and prints per-record errors to stderr without aborting. This decouples import logic from database logic and makes adding new import sources trivial (just implement the trait). The `ImportError` struct carries source path and line number for user-friendly diagnostics.