zsh-ai is a lightweight AI assistant that enables users to convert natural language into shell commands with ease. With a tiny footprint and no dependencies, just type what you need and receive the exact command. Ideal for quick setups, this tool prioritizes user privacy while being fast and simple to use.
zsh-ai: Your Lightweight AI Assistant for Shell Commands
zsh-ai is a simple yet powerful tool that transforms natural language into shell commands instantly. Designed for efficiency and ease of use, it eliminates the need for complex setups and dependencies, allowing users to execute commands with minimal effort. Just type what you wish to accomplish in plain English, and zsh-ai will generate the exact command you need.
Key Features
- Lightweight: With a minimal file size of just 5KB, zsh-ai operates as a standalone shell script without the need for additional frameworks such as Python or Node.js.
- Speed: The tool starts in an instant, seamlessly integrating with your existing shell environment.
- Simplicity: Users can easily input their requests by typing
# what you want to do
, providing a straightforward user experience. - Privacy-Oriented: By utilizing your own API keys, zsh-ai ensures that commands are executed locally, safeguarding your data.
- Zero Dependencies: While the tool operates independently, the optional installation of
jq
can enhance reliability.
Usage Examples
Here are a few commands that can be generated using zsh-ai:
$ # find all large files modified this week
$ find . -type f -size +50M -mtime -7
$ # kill process using port 3000
$ lsof -ti:3000 | xargs kill -9
$ # compress images in current directory
$ for img in *.{jpg,png}; do convert "$img" -quality 85 "$img"; done
By simply typing requests, zsh-ai takes care of the command generation for you.
Prerequisites
- zsh 5.0+: A modern version of zsh is recommended for optimal performance.
- Anthropic API Key: A one-time setup is required to enable API functionality.
- curl: This tool typically comes pre-installed on macOS and Linux systems.
- jq (optional): For enhanced parsing capabilities, installing
jq
is suggested.
Installation Methods
-
Homebrew (Recommended):
brew tap matheusml/zsh-ai brew install zsh-ai source $(brew --prefix)/share/zsh-ai/zsh-ai.plugin.zsh
-
Oh My Zsh:
git clone https://github.com/matheusml/zsh-ai ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-ai
Add
zsh-ai
to your plugins list in~/.zshrc
. -
Manual Installation:
git clone https://github.com/matheusml/zsh-ai ~/.zsh-ai echo "source ~/.zsh-ai/zsh-ai.plugin.zsh" >> ~/.zshrc
Setup
Set your Anthropic API key in your terminal:
export ANTHROPIC_API_KEY="your-api-key-here"
Make this change permanent by adding it to your ~/.zshrc
file.
Security and Privacy
- The API key is not stored by the plugin, ensuring the safety of user credentials.
- Commands are generated locally and are not logged; users should always verify commands before execution.
Contributions
Community involvement is encouraged. Open issues or submit pull requests for significant changes.
No comments yet.
Sign in to be the first to comment.