Overview
codechat is a command-line AI tool that lets you analyze and interact with any codebase by asking questions about the code. Powered by OpenAI's GPT models, it helps you understand, review, and refactor codebases quickly and efficiently.
Key Features
- Load and parse multiple source code files from a directory
- Ask natural language questions about the entire codebase
- Interactive chat mode for continuous Q&A
- Supports many common programming languages and file types
- Lightweight and easy to install via pip
Usage
codechat /path/to/codebase -q "your question about the codebase"
Example:
codechat ./my_project -q "what does this codebase do?"
Interactive Mode
Run without the -q flag to enter an interactive chat mode:
codechat ./my_project
Type your questions and get answers. Type exit or quit to leave.
Technologies Used
- Python: as the programming language.
- OpenAI API: for chatting with the codebase in natural language.
- ChatGPT: as my coding companion.
Challenges and Learnings
One of the biggest challenges with this project was the multi-file implementation. This returned so many import errors initially, which were debugged and fixed later.
Outcome
A CLI tool with which you & I can chat with a codebase in natural language (plain English), to learn & understand it, to find & fix errors, and more.