Skip to content

Latest commit

 

History

History
94 lines (64 loc) · 2.45 KB

README.md

File metadata and controls

94 lines (64 loc) · 2.45 KB

SHAI

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

Warning

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.

Getting the CLI tool

Prerequisites

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

Downloading the tool from GitHub

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

Running the tool from source

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

clojure -M -m shai.cli <query>

Babashka

Ensure that you have the bb (babashka) command line tool installed. Then run the following command:

bb -m shai.cli <query>

Java JAR

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>

Native Executable

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>