PitchHut logo
BSH (Better Shell History)
Revolutionizing terminal history with predictive intelligence.
Pitch

BSH is a cutting-edge CLI middleware designed to enhance terminal usability by replacing traditional history files with a dynamic SQLite database. With context-aware suggestions based on Git branches and command success rates, it streamlines command retrieval and enables a smarter, faster workflow.

Description

BSH (Better Shell History) is an innovative command-line interface (CLI) middleware that revolutionizes the terminal experience by transforming conventional flat history files (such as .zsh_history) into a structured local SQLite database. Built using C++20, BSH is optimized for performance and offers a unique "Live Predictive" Text User Interface (TUI) that provides contextual suggestions based on the current directory, active Git branch, and execution success rates.

Key Features

Context-Aware Command Retrieval

Standard shells provide a global history list, which may often yield irrelevant search results. BSH enhances command retrieval with distinct scopes:

  • Global Scope: Access the entire execution history.
  • Directory Scope: Filter commands executed within the current folder.
  • Git Branch Scope: Retrieve commands specific to the active Git branch, allowing for tailored suggestions during project development.

Real-Time Suggestion Interface

The BSH TUI integrates seamlessly with the Zsh Line Editor (ZLE), displaying a dynamically updated "Top 5" list of relevant command suggestions, eliminating the need for traditional search commands like Ctrl+R.

Intelligent Exit Code Tracking

BSH records the exit code of each executed command, offering a "Success Filter" that hides failed commands, such as typos or compilation issues, ensuring that suggestions remain valid and executable.

Local Data Architecture

BSH is designed with a client-daemon architecture that prioritizes data privacy. It operates entirely on the local machine, with no telemetry or command history sent to external servers, adhering to stringent data protection standards.

Technical Overview

BSH employs a sophisticated Client-Daemon architecture that achieves sub-5ms latency:

  • bsh-daemon: A background C++ process that manages database connections, Git branch resolution, and asynchronous writes.
  • bsh Client: A lightweight CLI tool that interfaces with the daemon via a Unix Domain Socket, facilitating efficient communication for command execution and logging.

Usage and Bindings

The BSH TUI activates automatically upon command input:

Key BindingAction
EnterExecutes the entered command.
Alt/Option + 1-5Executes the corresponding suggestion from the Top 5 list.
Alt/Option + ArrowsCycles through search contexts: Global <-> Directory <-> Git Branch.
Ctrl + FToggles the visibility of commands that failed execution.

Designed for performance-critical environments, BSH provides a groundbreaking efficiency boost to terminal command history management, making shell interactions smarter and more intuitive.

0 comments

No comments yet.

Sign in to be the first to comment.