Skip to content

ebubecodes/code-review-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

code-review-agent

Setup & Usage

Prerequisites

  • Bun v1.2.22 or later
  • Node.js (optional, for compatibility)
  • Git (for code diff tools)

Install dependencies

bun install

Running the Agent

To start the code review agent:

bun run index.ts

By default, the agent will review code changes in the ../code-review-agent directory and output review suggestions to the terminal.

Example Output

Reviewing file: tools.ts
- The function `getFileChangesInDirectory` is well-structured and uses async/await properly.
- Consider handling errors from `simpleGit` to improve robustness.
- Nit: Exclude more build artifacts if present (e.g., `node_modules`).

Reviewing file: index.ts
- Good use of streaming output for real-time feedback.
- Consider making the review directory configurable via CLI argument.

Nice use of Zod schemas for input validation!

Environment Variables & API Keys

To use the agent, you must provide API keys for the underlying LLMs (e.g., Google Gemini).

  1. Copy the example env file:

    cp .env.example .env
  2. Edit the new .env file and add your API keys:

    • GOOGLE_API_KEY — Your Google Gemini API key (required)
    • Add any other keys as needed

Customization

  • To change the directory being reviewed, edit the prompt in index.ts.
  • To add or modify tools, see tools.ts.

Project Structure

  • index.ts: Entry point, runs the agent
  • tools.ts: Implements code review and file change tools
  • prompts.ts: System prompt for the agent's review style
  • package.json: Dependencies and scripts
  • bun.lock: Bun lockfile
  • tsconfig.json: TypeScript config

This project was created using bun init in bun v1.2.22. Bun is a fast all-in-one JavaScript runtime.

About

A simple code review agent

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published