Skip to main content

CLI tool to get command suggestions from OpenAI or local LLM and interactively select them.

Project description

shai 🤖

AI-powered shell command suggestions

Overview

shai is a command-line tool that converts natural language into shell commands using AI. Simply describe what you want to do, and shai will suggest the appropriate commands.

Installation

Using pip

pip install shai

Quick Start

First, set your model to use:

export HOST_URL='model-host'
export MODEL_NAME='model-name-to-use'
export API_KEY='your-api-key'
export DEFAUT_SUGGESTIONS=2

Then use shai:

shai run docker test

Usage

Basic Usage

shai "create a new python virtual environment" -n 2

Examples

  1. Docker operations:
$ shai "run nginx container with port 80"
1. docker run -p 80:80 nginx
2. docker run -d -p 80:80 nginx
Choose a command to execute (or 0 to cancel):
  1. File operations:
$ shai "find all pdf files in current directory"
1. find . -name "*.pdf"
2. find . -type f -name "*.pdf"
Choose a command to execute (or 0 to cancel):
  1. Git operations:
$ shai "undo last git commit"
1. git reset --soft HEAD~1
2. git reset --hard HEAD~1
Choose a command to execute (or 0 to cancel):

Features

  • 🌟 Natural language command generation
  • 🎯 Multiple command suggestions
  • ✅ Command execution confirmation
  • 🔄 Interactive command selection
  • 🛡️ Safe execution with confirmation
  • 📝 Clear and helpful suggestions

How It Works

  1. You describe what you want to do in plain English
  2. shai sends your request to LLM to generate command suggestions
  3. You choose which command to execute
  4. shai executes the selected command after confirmation

Requirements

  • Python 3.9 or higher
  • Running LLM (Local or OpenAI model)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Security

  • 🔒 Commands are never executed without explicit confirmation
  • 🔑 API keys are handled securely via environment variables
  • ⚠️ Always review suggested commands before execution

Limitations

  • Requires active internet connection
  • Depends on the LLM availability
  • May incur API usage costs
  • Suggestions may not always be perfect

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • "Attention is all you need" paper
  • The Python community for amazing tools and libraries
  • All contributors who help improve this project

Made with ❤️ by Islam Almersawi

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

onprem_shai-0.0.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

onprem_shai-0.0.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file onprem_shai-0.0.2.tar.gz.

File metadata

  • Download URL: onprem_shai-0.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for onprem_shai-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d7a08b0da61bba96fc1af890e4347d1570308ea6b9694b431de7b17d0f2f9237
MD5 cc741765242a7c9a847d99c69096ffc7
BLAKE2b-256 a6969ff01b1f776654b553926d8335beb0e3bc1d48353584e5ce0d1bbd9b1368

See more details on using hashes here.

File details

Details for the file onprem_shai-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: onprem_shai-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for onprem_shai-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8c580fdb34c5ab2291cff99e52af15e10d93ea6255ab6ec782341bc49b73219e
MD5 60cd7b56394e4d3663475370e113b2ea
BLAKE2b-256 25977393da7e3fd912b721dafa28dc8798bfb6020c45a176ad22ecd7014c2636

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