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.
- 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.
- Python 3.10+ installed on your system
- Google Gemini API key (Get yours here: https://makersuite.google.com/app/apikey)
-
Clone the repository
git clone https://github.com/darginmathi/Cody cd Cody
-
Set up virtual environment (recommended)
python3 -m venv .venv source .venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
touch .env
Add your Gemini API key to the
.env
file:GEMINI_API_KEY=your_api_key_here
-
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
- Update
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
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...
- 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