Command line tool that uses Google's Gemini Pro model with Google AI Studio's rest API to generate a shell command from a natural language description of a task.
shai.mp4
This tools is just a toy project, and always remember to be careful when running commands generated by an AI model. Never run commands that you don't understand.
Only you are responsible for the commands you run on your system.
You need a an API key to use the Gemini API, you can get one by following the instructions here.
Then you need to set the GOOGLE_AI_STUDIO_API_KEY
environment variable to the value of your API key.
export GOOGLE_AI_STUDIO_API_KEY=<your API key>
or add the following line to your ~/.bashrc
or ~/.zshrc
file:
echo "export GOOGLE_AI_STUDIO_API_KEY=<your API key>" >> ~/.bashrc
source ~/.bashrc
curl -LO https://github.com/galuque/shai/releases/download/v0.1.29/shai-0.1.29-linux-static-amd64 > shai
chmod +x shai
./shai <query>
# or move the file to a directory in your PATH to make it available from anywhere
sudo mv shai /usr/local/bin
Clone the repository and navigate to the project directory:
git clone https://github.com/galuque/shai.git
cd shai
Also, you need to have the following installed:
- Clojure CLI
- Babashka (Optional, for running the tool with babashka)
- GraalVM (Optional, for building native executables with the
native-image
command)
clojure -M -m shai.cli <query>
Ensure that you have the bb
(babashka) command line tool installed. Then run the following command:
bb -m shai.cli <query>
First build the JAR file with the following command:
clojure -T:build uber
Then run the JAR file with the following command:
java -jar target/shai.cli-*.jar <query>
First build the native executable with the following command:
clojure -T:build uber && bash native.sh
Then run the native executable with the following command:
./target/shai <query>