A command-line tool that uses AI to generate and execute terminal commands from natural language descriptions.
pls is a macOS terminal assistant powered by local AI (via Ollama) that translates your plain English requests into executable shell commands. It can also answer technical questions about macOS in a conversational mode.
- 🤖 Natural Language to Commands: Describe what you want to do, get the exact command
- 💬 Ask Mode: Get technical answers and explanations with the
-aflag - ⚡ Smart Ollama Management: Automatically starts/stops Ollama server as needed
- 🎨 Beautiful Terminal UI: Rich formatting with syntax highlighting and interactive prompts
- 🔒 Safety First: Always shows the command and asks for confirmation before execution
- Python 3.x
- macOS
- Ollama installed
llama3.1:8bmodel pulled (ollama pull llama3.1:8b)
pip install ollama rich requests- Clone or download the script
- Make it executable:
chmod +x pls
- (Optional) Move to your PATH:
sudo mv pls /usr/local/bin/
Generate and execute commands from natural language:
pls "find all python files in current directory"
pls "compress Documents folder"
pls "show disk usage"The tool will:
- Generate the appropriate command
- Display it with syntax highlighting
- Ask for confirmation before running
Get answers to technical questions:
pls -a "how do I change file permissions?"
pls -a "what's the difference between chmod and chown?"
pls -a "explain the find command"- Ollama Detection: Checks if Ollama server is running
- Auto-Start: Starts Ollama automatically if needed (with a neat loading animation)
- AI Processing: Sends your query to the
llama3.1:8bmodel - Smart Output:
- Command mode: Shows executable command with confirmation prompt
- Ask mode: Displays helpful answer in a formatted panel
- Cleanup: Shuts down Ollama if it wasn't running before (saves resources)
Edit these variables at the top of the script to customize:
MODEL = "llama3.1:8b" # Change AI model
OLLAMA_API_URL = "http://127.0.0.1:11434" # Change Ollama endpoint# Find large files
pls "find files larger than 100MB"
# Git operations
pls "create a new git branch called feature-x"
# System info
pls "show CPU temperature"
# Ask for help
pls -a "how do I monitor network traffic?"- Commands are always shown before execution
- User confirmation required (Y/n prompt)
- Graceful interrupt handling (Ctrl+C)
- Automatic cleanup of zombie processes
Ollama won't start:
- Ensure Ollama is installed:
brew install ollama - Check if the model is available:
ollama list
Model not found:
ollama pull llama3.1:8bPermission errors:
- Make sure the script is executable:
chmod +x pls
This is a utility script provided as-is. Modify and use freely under the MIT license.
Feel free to fork and customize for your needs! Some ideas:
- Add support for other AI models
- Implement command history
- Add shell completion
- Support for other operating systems
Note: This tool executes commands on your system. Always review generated commands before confirming execution.