This repository contains the proof-of-concept for an AI agent and Gemini CLI extension that automatically generates test cases based on code review feedback.
It includes:
- A sample Node.js application (
/src
). - A Gemini CLI extension (
/test-agent
) with custom commands. - A pre-staged test scenario (
/review-scenario
) to demonstrate the workflow. - The PRD and Design documents for the project.
To get started, you will need node
, npm
, and the gemini
CLI installed.
-
Clone the repository:
git clone <your-repo-url> cd test-agent
-
Install project dependencies: This installs
jest
for the sample application.npm install
-
Link the Gemini CLI extension: This command makes the
/generate-test-from-finding
and/commit-test
commands available to the Gemini CLI. It must be run from the project root directory (test-agent/
).gemini extensions link test-agent
After completing the installation steps above, you can test the full workflow in the pre-staged scenario.
-
Navigate into the scenario directory:
cd review-scenario
-
Run Code Review: Ask the agent to review the staged changes.
gemini /code-review
You should see a report identifying a division-by-zero risk in
src/calculator.js
. -
Generate a Test for the Finding: Use our custom command to generate a test for the finding from the report.
gemini /generate-test-from-finding src/calculator.js 2
The agent will suggest a new test case and instruct you to run
/commit-test
. -
Commit the New Test: Run the commit command to apply the suggested test to your local file.
gemini /commit-test
(Note: In this MVP, this step will fail due to CLI sandboxing, but it demonstrates the intended workflow.)
-
Verify the Test Fails: Manually apply the suggested test to
src/calculator.test.js
and run the test suite. The new test should fail, proving it caught the bug.npm test