Skip to content

Files

Latest commit

 

History

History
122 lines (97 loc) · 4.42 KB

README.md

File metadata and controls

122 lines (97 loc) · 4.42 KB

Node.js JavaScript Gemini API

Shellmancer Banner

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.

🚀 Features

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

🛠️ New Basic Commands:

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)

📥 Installation

Install via npm:

npm install -g shellmancer

This will install shellmancer globally, allowing you to run it from anywhere in your terminal.

Or Clone the Repository Manually:

git clone https://github.com/yourusername/shellmancer.git
cd shellmancer
npm install

📌 Usage

🔹 Run the CLI

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.

🔹 Available Commands

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

🔹 Basic Commands

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)

🔹 Interactive Chat Mode

Run shellmancer without any arguments and type queries when prompted.
To exit, type exit.


🌐 API Integration

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.


🔗 Acknowledgements

Built using:

📜 License

This project is licensed under the MIT License.