A Zsh plugin that allows you to interact with your shell using natural language.
- 🤖 Converts natural language to shell commands
- 🔄 Supports OpenAI-compatible API endpoints
- ⌨️ Simple keyboard shortcuts:
- Linux/Windows:
Alt+Enter
orCtrl+⬇️
- macOS:
Option+Return
- Linux/Windows:
- Zsh shell
- curl command-line tool
- jq JSON processor
- OpenAI API key or compatible service
Add to your .zsh_plugins.txt
:
PsychArch/nlsh
Or add directly to your .zshrc
:
# Initialize antidote
source ${ZDOTDIR:-~}/.antidote/antidote.zsh
source <(antidote init)
# Add nlsh plugin
antidote bundle PsychArch/nlsh
# 1. Clone the repository
git clone https://github.com/PsychArch/nlsh ~/.nlsh
# 2. Add to your .zshrc
echo 'source ~/.nlsh/nlsh.plugin.zsh' >> ~/.zshrc
# 3. Reload your shell
source ~/.zshrc
- Type your natural language command in the terminal
- Press the keyboard shortcut for your platform:
- Linux/Windows:
Alt+Enter
orCtrl+⬇️
- macOS:
Option+Return
- Linux/Windows:
- Review the generated shell command
- Press
Enter
to execute or modify as needed
Configure the plugin using these environment variables in your .zshrc
:
# Required
export OPENAI_API_KEY="your-api-key"
# Optional configurations
export OPENAI_MODEL="gpt-4" # Default: gpt-3.5-turbo
export OPENAI_URL_BASE="https://your-api-endpoint.com" # Default: https://api.openai.com
export OPENAI_PROXY="http://proxy.example.com:8080" # Optional: HTTP proxy
- The plugin captures your natural language input when triggered
- Collects relevant system information:
- Operating system
- Distribution details
- User privileges
- Sends a request to the configured OpenAI-compatible API
- Converts the response into an executable shell command
- Review generated commands before execution
- Be cautious with sensitive system commands
- Keep your API key secure
This project is licensed under the MIT License - see the LICENSE file for details.