AI-powered shell command suggestions
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.
You can use OpenAI or a local LLM as long as it follows the same format and supports the structured output feature. vLLM models are tested and supported.
pip install onprem-shaiFirst, set your model to use:
export SHAI_BASE_URL='model-host'
export SHAI_MODEL_NAME='model-name-to-use'
export SHAI_API_KEY='your-api-key'
export SHAI_DEFAULT_SUGGESTIONS=2Then use shai:
shai run docker testshai create a new python virtual environment- 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):- 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):- 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):- 🌟 Natural language command generation
- 🎯 Multiple command suggestions
- ✅ Command execution confirmation
- 🔄 Interactive command selection
- 🛡️ Safe execution with confirmation
- 📝 Clear and helpful suggestions
- You describe what you want to do in plain English
shaisends your request to LLM to generate command suggestions- You choose which command to execute
shaiexecutes the selected command after confirmation
- Python 3.9 or higher
- Running LLM (Local or OpenAI model)
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- 🔒 Commands are never executed without explicit confirmation
- 🔑 API keys are handled securely via environment variables
⚠️ Always review suggested commands before execution
- Requires active internet connection
- Depends on the LLM availability
- May incur API usage costs
- Suggestions may not always be perfect
This project is licensed under the MIT License - see the LICENSE file for details.
- "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