Skip to content

prabhat-krai/cli-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLI Copilot (ch)

Note: This project was completely generated with Antigravity.

CLI Copilot is a command-line tool that translates natural language queries into shell commands using your favorite Local or Cloud LLMs. It supports multiple providers like Google Gemini, Anthropic Claude, OpenAI, Ollama, and OpenRouter.

Features

  • Natural Language to Shell: Just ask what you want to do.
  • Safety First: It shows you the command and waits for your confirmation (A to accept, R to reject) before executing.
  • Multiple Providers: Supports Gemini (default), Anthropic, OpenAI, Ollama, and OpenRouter.

    Note: Currently, Gemini and Anthropic are fully tested. Other providers (OpenAI, Ollama, OpenRouter) are implemented but experimental.

  • Configurable Models: Choose specific models for each provider.
  • Cross-Platform: Works on macOS, Linux, and Windows.

Installation

User Installation (Recommended)

To install ch globally on your system:

git clone https://github.com/prabhat-krai/cli-copilot.git
cd cli-copilot
./install.sh

or using uv directly if you have it:

uv tool install git+https://github.com/prabhat-krai/cli-copilot.git

Development Installation

  1. Clone the repository:
    git clone https://github.com/prabhat-krai/cli-copilot.git
    cd cli-copilot
  2. Install dependencies using uv:
    uv sync
  3. Run from source:
    uv run ch "your query"

Usage

Once installed, use the ch command:

ch "count all files in this folder recursively"

The tool will suggest a command (e.g., find . -type f | wc -l). Press A to execute it or R to cancel.

selecting a Provider

By default, it uses Gemini. You can change the provider using the --provider flag or an environment variable.

Flags:

ch --provider openai "list files"
ch --provider anthropic "check disk space"
ch --provider ollama --model llama3 "hello world"

Environment Variable:

export CLI_COPILOT_PROVIDER=anthropic

Environment Variables

You must set the API key for the provider you choose:

  • Gemini: GEMINI_API_KEY
  • Anthropic: ANTHROPIC_API_KEY
  • OpenAI: OPENAI_API_KEY
  • OpenRouter: OPENROUTER_API_KEY

Quick Setup

Copy the example environment file and add your API keys:

cp .env.example .env

Then edit .env and replace the placeholder values with your actual API keys. The .env file is ignored by git, so your keys stay private.

Example

$ ch "find all python files modified in the last 24 hours"

Suggested Command:
find . -name "*.py" -mtime -1

Execute this command? (A)ccept / (R)eject [a/A/r/R] (A):

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors