Skip to main content

AI-powered terminal command recommender based on your shell history

Project description

 ___   ___   _____   ___   ___   __ __    __    _
| _ \ | __| |_   _| | __| | _ \ |  V  |  /  \  | |
| v / | _|    | |   | _|  | v / | \_/ | | /\ | | |
|_|_\ |___|   |_|   |___| |_|_\ |_| |_| |_||_| |_|

[reTermAI] Smart command assistant for your terminal 🧠💻

reTermAI

💡 A terminal command recommender powered by AI and your own shell history.


✨ Features

  • 🔍 Recommends relevant terminal commands based on your past history using OpenAI or Gemini
  • 🧠 Supports intelligent matching by keyword or partial input
  • ⚡ Easy to install via pip
  • 🐚 Supports zsh and bash shell history
  • 🔐 API keys managed via .env

📦 Installation

pip install reterm-ai

Or, for local development:

git clone https://github.com/pie0902/reTermAI.git
cd reTermAI
pip install -e .

⚙️ Usage

🔮 AI-powered command suggestions:

reterm suggest

Options:

Option Description
--history-limit, -hl Number of recent commands to read (default: 300)
--context-limit, -cl How many commands to feed into the LLM (default: 20)
--provider, -p LLM to use (openai or gemini)

Examples:

reterm suggest -p gemini
reterm suggest --history-limit 500 --context-limit 30

🔎 Match past commands by keyword:

reterm match docker

Options:

Option Description
--limit, -l Max number of matching results to show (default: 5)

🔐 Configuration

Add a .env file in your home or project directory:

OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxx
GOOGLE_API_KEY=your-gemini-api-key
Key Used for
OPENAI_API_KEY Required if using --provider openai
GOOGLE_API_KEY Required if using --provider gemini

You can also refer to the included .env.example.


📂 Project Structure

reterm/
├── cli.py          # Main CLI interface
├── llm.py          # LLM integration (OpenAI, Gemini)
├── shell.py        # Shell history detection and parsing
├── config.py       # API key loader
├── welcome.py      # ASCII and help panel

🧑‍💻 Contributing

We welcome contributions! Fork the repo, create a feature branch, and open a pull request.

git checkout -b feat/your-feature

Optional ideas:

  • Add support for fish shell
  • Add model options (e.g. gpt-4o, gemini-pro)
  • Improve LLM prompt formatting

📄 License

Apache License 2.0

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

reterm_ai-0.1.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

reterm_ai-0.1.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file reterm_ai-0.1.0.tar.gz.

File metadata

  • Download URL: reterm_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for reterm_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 05a2a2687e33c1b089bdd8ed4c1cffb03f8da8efa374b0662881ef4512fc4edc
MD5 6f273ac317ad57ea78c93b9fc8c7604d
BLAKE2b-256 f03dab6874c936f77121e215ec10e66251e07f2583f154585370160028e860a6

See more details on using hashes here.

File details

Details for the file reterm_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: reterm_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for reterm_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07d1a3ac8f6a43fd909c8ac15626c13b439db3b04b01fac34493ba06c5da39a7
MD5 d2c9940d534622737a778980288556a7
BLAKE2b-256 162c27c8d1819cb5f84262eadf70463da0b93d5ef4df0f6e44da66bcaf7be1c1

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