Skip to main content

JHA - Just Help Assistant. LLM-powered CLI command discovery.

Project description

jha-cli : a CLI tool for just-in-time shell command discovery.

If you prefer working in the terminal but sometimes fall short on remembering commands, this CLI tool can help. It’s also useful for anyone still getting comfortable with the command line.

It uses OpenAI models to interpret natural-language queries and suggest relevant shell commands.

Features

  • Query for suitable commands using natural language
  • Support for multiple shells (bash, zsh, cmd, PowerShell)
  • Get explanations for commands
  • Command history tracking for quick re-execution and recall
  • Option to jump to the last command from history
  • Simple config commands to set OPENAI_KEY, MODEL, and SHELL
  • Persistent configuration storage
  • Searched command stored in clipboard for quick execution

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Install from PyPI

pip install jha-cli

Alternative Installation (Windows)

pip install pipx
python -m pipx ensurepath
# Restart command prompt
pipx install jha-cli

Usage

Check Installation

jha
jha version
jha --help

Initial Setup

# Set your OpenAI API key
jha config set OPENAI_KEY=sk-your-api-key-here

# Set preferred model (optional)
jha config set MODEL=gpt-4o-mini

# Set your shell (optional)
jha config set SHELL=bash

Basic Commands

# Generate a command from natural language
jha "Move a folder with all its children to another location"

# Explain what a command does
jha explain "mv source_folder/ destination_folder/"

# Get explanation for the last generated command
jhax

# View command history
jha history

# Show the last query and command
jha last

# Check version
jha version

Configuration

The configuration file is stored at ~/.jha/config.json and all historical command stored at ~/.jha/history.json

Development Setup

  1. Clone/Download the project: https://github.com/jhaspider/jha-cli

  2. Create virtual environment:

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Install as CLI command:
pip install -e .

Architecture

The project uses the following key dependencies:

  • Typer: CLI framework for command parsing and routing
  • OpenAI Python SDK: Integration with OpenAI's API
  • Click & Rich: Terminal formatting and enhanced output
  • Pydantic: Data validation and settings management

Project Structure

jha-cli/
├── src/
│   ├── __init__.py
│   ├── __main__.py           # Entry point
│   ├── cli.py                # Main CLI commands
│   ├── config.py             # Configuration management
│   ├── llm.py                # LLM integration
│   ├── history.py            # Command history tracking
│   └── utils.py              # Utility functions
├── pyproject.toml            # Project configuration
├── requirements.txt          # Dependencies
└── README.md

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests on the GitHub repository.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jha_cli-1.0.6.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jha_cli-1.0.6-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file jha_cli-1.0.6.tar.gz.

File metadata

  • Download URL: jha_cli-1.0.6.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jha_cli-1.0.6.tar.gz
Algorithm Hash digest
SHA256 d03e7f040eef086fc8f885ccc9547d3cc3e5c3dcaa44298bac056c2df4a6997b
MD5 efc8be441939f610ea807aa6a9a1e09b
BLAKE2b-256 98d9f07e1c30511680c710c5ade7a3f7e4aae3aa6481f48226328d0a669b76b9

See more details on using hashes here.

File details

Details for the file jha_cli-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: jha_cli-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jha_cli-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 469ff6fe859eb04358fcbdb23272433fcbae11699187ecec32154422144fea3a
MD5 7058f3b0a61b68e7102d68dc02b618b0
BLAKE2b-256 c0ddb0ac33209a96918069c04fbfa11e369a5a5941e0752a718f3964eb31174b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page