- 🧠 Natural language to shell command conversion
- 🛡️ Built-in safety checks for dangerous commands
- ⚙️ Configurable settings via
.nlshrc
- 🎨 Colored output for better readability
- 📝 Command history and context awareness
- 🔄 Interactive and single command modes
- 🔒 Confirmation for potentially dangerous operations
- Go 1.21 or later
- OpenAI API key
Install directly using curl:
curl -fsSL https://raw.githubusercontent.com/abakermi/nlsh/master/install.sh | bash
go install github.com/abakermi/nlsh@latest
- Clone the repository:
git clone https://github.com/abakermi/nlsh.git cd nlsh
- Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY='your-api-key-here'
- Run the installation script:
./install.sh
- Restart your terminal or source your shell configuration:
source ~/.zshrc # or source ~/.bashrc
export OPENAI_API_KEY='your-api-key-here'
nlsh
nlsh "list all files in current directory"
# List files
nlsh "show me all hidden files"
# Git operations
nlsh "commit all changes with message 'update readme'"
# Docker operations
nlsh "show all running containers"
- Command confirmation before execution
- Configurable allowed/denied commands
- Pattern-based command filtering
- Protection against dangerous operations
Default configuration includes:
[safety]
confirm_execution = true
allowed_commands = [
"ls *",
"touch *",
"mkdir *",
"echo *",
"cat *",
"cp *",
"mv *",
"git *",
"docker *",
"code *",
"vim *",
"nano *"
]
denied_commands = [
"rm -rf /*",
"rm -rf /",
"dd if=/dev/*",
"mkfs.*",
"> /dev/*",
"shutdown *",
"reboot *",
"halt *",
"*--no-preserve-root*"
]
You can customize nlsh's behavior by creating a .nlshrc
file in your home directory. The configuration file supports TOML format. Here's an example of a .nlshrc
file:
This project is open source and available under the MIT License.