An AI-powered shell command generator that converts natural language requests into executable shell commands for any operating system and shell environment.
Shell-Aid is a command-line tool that leverages Google's Gemini AI to help users generate shell commands from natural language descriptions. It automatically detects your operating system and shell environment, then generates appropriate commands with detailed explanations and side-effect warnings. Whether you're a beginner learning shell commands or an expert working across multiple platforms, Shell-Aid makes command-line operations more accessible and safer.
- 🤖 AI-powered command generation using Google Gemini 2.5 Flash
- 🖥️ Cross-platform support (Windows, Linux, macOS)
- 🐚 Multi-shell support (PowerShell, Bash, Zsh, etc.)
- 📝 Step-by-step workflow explanations
⚠️ Side-effect warnings for potentially destructive operations- 🔗 Automatic command chaining for multi-step tasks
- 💬 Interactive console interface
- Go 1.25.3 or higher
- Google Gemini API key (Get one here)
Before running Shell-Aid, you need to configure your Google Gemini API key:
- Open
utils/ai/command.go - Locate the
keyconstant at the top of the file - Replace the empty string with your API key:
const key string = "your-api-key-here"Note: For production use, consider using environment variables instead of hardcoding the API key.
- Clone the repository:
git clone https://github.com/Aditya-0011/Go.git
cd Go/shell-aid- Install dependencies:
go mod download- Build the application:
go build -o shell-aid- Run the application:
./shell-aidOn Windows:
go build -o shell-aid.exe
.\shell-aid.exe$ ./shell-aid
Enter your request (press Enter on an empty line to finish), enter 'exit' to quit:
find all .txt files modified in the last 7 days
Processing Request
Workflow:
This command searches for files with the .txt extension that have been modified
within the last 7 days. It uses the find command to recursively search from the
current directory. The -type f flag ensures only files are matched, -name "*.txt"
filters for text files, and -mtime -7 specifies files modified in the last 7 days.
SideEffects:
This is a read-only operation with no side effects. It will not modify, delete,
or create any files. However, searching large directory structures may take time
and consume system resources.
Command:
find . -type f -name "*.txt" -mtime -7
Enter your request (press Enter on an empty line to finish), enter 'exit' to quit:
create a directory called backup, copy all .go files to it, and count how many files were copied
Processing Request
Workflow:
This command performs three operations: First, it creates a new directory named
"backup". Second, it copies all files with the .go extension from the current
directory to the backup directory. Third, it counts and displays the number of
.go files that were copied.
SideEffects:
This command will create a new directory and copy files. If the backup directory
already exists, mkdir may fail unless the -p flag is used. The copy operation will
overwrite existing files in the destination without warning.
Command:
mkdir -p backup && cp *.go backup/ && ls backup/*.go | wc -l
$ ./shell-aid
Enter your request (press Enter on an empty line to finish), enter 'exit' to quit:
show disk usage
Processing Request
[... command output ...]
Enter your request (press Enter on an empty line to finish), enter 'exit' to quit:
exit
Exiting.
- System Detection: Automatically detects your OS and shell environment
- Natural Language Input: Accept multi-line natural language requests
- AI Processing: Sends your request to Google Gemini with system context
- Command Generation: Receives structured response with workflow, side effects, and command
- Display: Shows formatted output with color-coded sections for easy reading
shell-aid/
├── main.go # Main application entry point
├── go.mod # Go module dependencies
├── lib/
│ └── objects.go # Data structures and types
└── utils/
├── ai/
│ └── command.go # AI command generation logic
├── console/
│ └── display.go # Console output formatting
└── shell/
├── posix.go # POSIX shell detection
└── windows.go # Windows shell detection
Contributions are welcome! Please feel free to submit issues or pull requests.