A minimalistic terminal chatbot for interacting with Google's Gemini 2.0 Flash API. This CLI tool allows you to query the Gemini API using your API key, which is stored persistently on your system.
✅ Interactive Chat – Ask questions and receive responses directly in your terminal.
✅ Persistent API Key Storage – The Gemini API key is stored in ~/.shell-sage-config.json
, so you don't have to re-enter it.
✅ Modern UI – Features a colorful ASCII banner and stylish prompts using figlet and chalk.
✅ Real-time API Calls – Uses axios for seamless communication with Gemini 2.0 Flash.
✅ Command Line Flags – Includes useful commands:
--help
→ Show available commands--version
→ Show the current version--model
→ Display the current Gemini model--remove-api
→ Remove the stored API key--update
→ Update shellmancer to the latest version
Command | Description |
---|---|
shellmancer explain "<shell command>" |
Get a beginner-friendly explanation of a shell command |
shellmancer generate-script "<description>" |
Generate a bash/zsh script based on a description |
shellmancer system-info |
Display system information (OS, CPU, Memory, etc.) |
shellmancer set-model <model> |
Set the default Gemini model (gemini-2.0-flash , gemini-2.0-pro ) |
npm install -g shellmancer
This will install shellmancer globally, allowing you to run it from anywhere in your terminal.
git clone https://github.com/yourusername/shellmancer.git
cd shellmancer
npm install
shellmancer
On the first run, you'll be prompted to enter your Gemini API key. The key is stored persistently in a hidden config file (~/.shell-sage-config.json
) and automatically loaded on future runs.
shellmancer --help # Show available commands
shellmancer --version # Show current version
shellmancer --model # Show the current Gemini model
shellmancer --remove-api # Remove the stored API key
shellmancer --update # Update shellmancer to the latest version
shellmancer explain "<shell command>"
# Get an explanation of a shell command
shellmancer generate-script "<description>"
# Generate a bash/zsh script
shellmancer system-info
# Display system information
shellmancer set-model <model>
# Change the Gemini model (e.g., gemini-2.0-flash, gemini-2.0-pro)
Run shellmancer
without any arguments and type queries when prompted.
To exit, type exit
.
This CLI interacts with the Gemini API using the following endpoint:
https://generativelanguage.googleapis.com/v1/models/gemini-2.0-flash:generateContent?key=YOUR_API_KEY
The API expects a JSON payload structured like this:
{
"contents": [
{
"parts": [
{ "text": "Your query goes here" }
]
}
]
}
The API key is dynamically inserted into the URL at runtime.
Built using:
- Axios – HTTP client for API requests
- Chalk – Terminal string styling
- Figlet – ASCII banners
- Nanospinner – Elegant CLI spinners
- Gradient String – Colorful terminal output
- Inquirer – Interactive CLI prompts
- Remove Markdown – Clean text formatting
This project is licensed under the MIT License.