- Bun v1.2.22 or later
- Node.js (optional, for compatibility)
- Git (for code diff tools)
bun installTo start the code review agent:
bun run index.tsBy default, the agent will review code changes in the ../code-review-agent directory and output review suggestions to the terminal.
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!To use the agent, you must provide API keys for the underlying LLMs (e.g., Google Gemini).
-
Copy the example env file:
cp .env.example .env
-
Edit the new
.envfile and add your API keys:GOOGLE_API_KEY— Your Google Gemini API key (required)- Add any other keys as needed
- To change the directory being reviewed, edit the prompt in
index.ts. - To add or modify tools, see
tools.ts.
index.ts: Entry point, runs the agenttools.ts: Implements code review and file change toolsprompts.ts: System prompt for the agent's review stylepackage.json: Dependencies and scriptsbun.lock: Bun lockfiletsconfig.json: TypeScript config
This project was created using bun init in bun v1.2.22. Bun is a fast all-in-one JavaScript runtime.