Skip to content

tallboy/clide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clide

A command-line interface for chatting with AI models (Claude from Anthropic and Gemini from Google) with file operation capabilities. This tool allows you to read and edit files in any directory on your system.

Features

  • Interactive chat with multiple AI models:
    • Claude (Anthropic's AI model)
    • Gemini (Google's AI model)
  • Built-in tools for file operations:
    • read_file: Read the contents of a file from any directory
    • list_files: List files and directories in any specified path
    • edit_file: Make edits to text files or create new files in any directory
  • Security features:
    • File size limits to prevent loading extremely large files
    • Content size validation
  • User-friendly interface:
    • Colorful terminal output
    • Helpful command system

Prerequisites

  • Go 1.18 or higher
  • API keys:
    • Anthropic API key (for Claude)
    • Google API key (for Gemini)

Installation

Basic Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/clide.git
    cd clide
    
  2. Install dependencies:

    go mod download
    
  3. Set up your API keys:

    # For Claude
    export ANTHROPIC_API_KEY=your_anthropic_api_key_here
    
    # For Gemini
    export GOOGLE_API_KEY=your_google_api_key_here
    export GOOGLE_PROJECT_ID=your_google_project_id_here  # Optional
    

Installing as a Global Command on macOS

To use Clide as a global command on macOS, follow these steps:

  1. Build the binary:

    go build -o clide
    
  2. Move the binary to a directory in your PATH:

    sudo mv clide /usr/local/bin/
    
  3. Make it executable:

    sudo chmod +x /usr/local/bin/clide
    
  4. Set up your API keys in your shell profile (e.g., ~/.zshrc or ~/.bash_profile):

    # For Claude
    echo 'export ANTHROPIC_API_KEY=your_anthropic_api_key_here' >> ~/.zshrc
    
    # For Gemini
    echo 'export GOOGLE_API_KEY=your_google_api_key_here' >> ~/.zshrc
    echo 'export GOOGLE_PROJECT_ID=your_google_project_id_here' >> ~/.zshrc  # Optional
    
    source ~/.zshrc
    

Now you can run clide from anywhere in your terminal.

Usage

Running Locally

Run the application with default settings (Claude):

go run main.go

To specify a different LLM provider:

# Use Claude (default)
go run main.go --provider claude

# Use Gemini
go run main.go --provider gemini

To specify a specific model:

# Specify Claude model
go run main.go --claude-model claude-3-5-sonnet-20240620

# Specify Gemini model
go run main.go --provider gemini --gemini-model gemini-1.5-pro-latest

Running as a Global Command

If you've installed it as a global command:

# Default (Claude)
clide

# Use Gemini
clide --provider gemini

# Specify models
clide --claude-model claude-3-5-sonnet-20240620
clide --provider gemini --gemini-model gemini-1.5-pro-latest

This will start an interactive chat session with the selected AI model. You can type messages and receive responses from the AI.

Available Commands

The application supports the following commands:

  • help - Display help information about available commands and tools
  • version - Display the application version and the configured LLM
  • exit - Exit the application

Available Tools

The agent has access to the following tools:

read_file

Reads the contents of a specified file.

Example:

AI: I can help you read a file. What file would you like me to read?
You: Please read the go.mod file.
AI: I'll read that file for you.

Another example with test.txt:

You: Please read test.txt
AI: I'll read that file for you.
[Tool Response]: Hello World!

list_files

Lists files and directories at a given path.

Example:

AI: I can list files in a directory for you. Which directory would you like to explore?
You: Please list the files in the current directory.
AI: Here are the files in the current directory:

edit_file

Makes edits to a text file or creates a new file.

Example:

AI: I can help you edit a file. What changes would you like to make?
You: Please create a new file called example.txt with "Hello, world!" as its content.
AI: I've created the file for you.

git_log

Shows commit logs of the Git repository.

Example:

You: Show me the last 3 commits.
AI: Certainly! I'll use the git_log tool to show you the last 3 commits.
[Tool Response]: abc1234 Add new feature X
def5678 Fix bug in module Y
ghi9012 Update documentation

git_status

Shows the working tree status of the Git repository.

Example:

You: What's the current status of the Git repository?
AI: I'll check the Git status for you.
[Tool Response]: On branch main
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   main.go

git_diff

Shows changes between commits, commit and working tree, etc.

Example:

You: What changes have been made to main.go?
AI: I'll show you the changes made to main.go using the git_diff tool.
[Tool Response]: diff --git a/main.go b/main.go
...
[Diff output for main.go]

Project Structure

The project contains the following key files:

  • main.go: Main application code with CLI interface and AI model integration
  • go.mod: Go module definition with dependencies
  • go.sum: Go module checksums
  • test.txt: A simple test file containing "Hello World!"
  • .gitignore: Standard Go project gitignore file

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages