A smart CLI tool that generates and executes terminal commands based on natural language descriptions.
AI Command Generator uses Gemini AI to turn natural language descriptions into executable shell commands. Simply describe what you want to do, and the tool will generate the appropriate command for you.
- 🧠 Generate commands from natural language descriptions
- 🔄 Modify existing commands by describing changes
- ⚡ Interactive TUI mode with command preview
- 📋 Copy commands to clipboard
- 🚀 Direct execution mode with
--cliflag
- Go 1.18 or higher
- Gemini API key (required)
- Make(optional)
- Visit Google AI Studio
- Create or sign in to your Google account
- Generate a new API key
- Save this key securely - you'll need it to build the application
-
Clone the repository:
git clone https://github.com/vivalchemy/ai-command-generator.git cd ai-command-generator -
Set your Gemini API key in the Makefile:
Note: If you don't have
makeinstalled, then copy the command below to your terminal and run it.# Replace <your_gemini_api_key> with your actual API key build: go build -o ai -ldflags "-X 'main.apiKey=YOUR_ACTUAL_API_KEY_HERE'" main.go
-
Build the application(skip if you don't have
makeinstalled):make build
This will create an executable named
aiin your project directory. -
(Optional) Add to your PATH:
cp ai ~/.local/bin -
Add
~/.local/binto your PATH environment variable:export PATH="$PATH:~/.local/bin"
ai "list all files in the current directory, including hidden files"ai "ls -l only show files larger than 1MB and sort by size"Use the --cli flag to execute the generated command immediately without the interactive UI:
ai --cli "find all jpg files in the current directory"ai "find all log files modified in the last 24 hours"ai "extract all email addresses from a text file"ai "show CPU and memory usage sorted by usage"ai "scan open ports on localhost"- The tool takes your description as input
- Sends it to Gemini AI with a specialized system prompt
- Gets back a proper shell command
- Displays the command with options to:
- Execute the command
- Copy to clipboard
- Quit without action
.
├── main.go # Main application code
├── Makefile # Build configuration
├── assets/ # Project assets
│ └── demo.gif # Demo animation
├── README.md # This file
└── .env.example # Example environment variables
This project is licensed under the MIT License. See the LICENSE file for more information.
- Built with Charm Bubble Tea for the terminal UI
- Powered by Google Gemini AI
Contributions are welcome! Please feel free to submit a Pull Request.
