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.
- 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 directorylist_files: List files and directories in any specified pathedit_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
- Go 1.18 or higher
- API keys:
- Anthropic API key (for Claude)
- Google API key (for Gemini)
-
Clone this repository:
git clone https://github.com/yourusername/clide.git cd clide -
Install dependencies:
go mod download -
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
To use Clide as a global command on macOS, follow these steps:
-
Build the binary:
go build -o clide -
Move the binary to a directory in your PATH:
sudo mv clide /usr/local/bin/ -
Make it executable:
sudo chmod +x /usr/local/bin/clide -
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.
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
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.
The application supports the following commands:
help- Display help information about available commands and toolsversion- Display the application version and the configured LLMexit- Exit the application
The agent has access to the following tools:
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!
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:
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.
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
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
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]
The project contains the following key files:
main.go: Main application code with CLI interface and AI model integrationgo.mod: Go module definition with dependenciesgo.sum: Go module checksumstest.txt: A simple test file containing "Hello World!".gitignore: Standard Go project gitignore file
Contributions are welcome! Please feel free to submit a Pull Request.