Skip to content

darginmathi/Cody

Repository files navigation

Cody

A Command-Line AI Coding Assistant powered by Google Gemini

Cody is an intelligent coding companion that brings AI-powered assistance directly to your terminal. Built with Python and integrated with Google's Gemini API, Cody can read, write, execute, and explain code while maintaining a conversational interface that feels natural and intuitive.

Features

  • Terminal Interface: Chat with your AI coding assistant directly from the command line
  • Code Generation: Generate code snippets and complete programs based on prompts
  • Code Execution: Run Python scripts with real-time feedback and error handling
  • File Operations: Read from and write to files in your project directory
  • Code Explanation: Get detailed explanations for complex code structures and algorithms
  • Conversational AI: Talk with it XD.

Quick Start

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/darginmathi/Cody
    cd Cody
  2. Set up virtual environment (recommended)

    python3 -m venv .venv
    source .venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment variables

    touch .env

    Add your Gemini API key to the .env file:

    GEMINI_API_KEY=your_api_key_here
    
  5. Configure settings

    • Update WORKING_DIR in the config file to point to your project directory
    • Adjust MAX_CHARS if you need to work with larger files

Usage

Start Cody with:

python main.py

Once started, you can interact with Cody:

> Explain how bubble sort works
> Create a function to reverse a string
> Run the script ./examples/hello.py
> Write a simple calculator

Example Interactions

Code Generation:

User: Write a simple calculator
Cody: I have written the code for a simple calculator to the file `calculator.py`...

Code Explanation:

User: Explain the code in my_algorithm.py
Cody: This code implements a depth-first search algorithm. Let me break it down...

File Operations:

User: Read the contents of ./data/config.json and explain its structure
Cody: I'll read the file and analyze its structure for you...

Current Limitations

  • Python Only: Code execution is currently limited to Python scripts
  • Path Specification: Need to manually set working directory so that Cody only has access to specified directory

About

Coding agent made with Gemini API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages