CLI project that reviews a single source file using Gemini and prints a structured report in the terminal.
- Reads a code file from disk
- Sends it to Gemini with a strict JSON schema
- Validates response with Pydantic
- Renders results with Rich panels/tables
.
|- analyzer.py # Gemini request + schema-based parsing
|- schemas.py # Pydantic response model
|- main.py # CLI and Rich output
|- examples/ # sample files to analyze
- Python 3.10+
- Gemini API key
python -m venv venv
# Windows:
venv\Scripts\activate
# Linux/macOS:
source venv/bin/activate
pip install google-genai pydantic python-dotenv typer richCreate a .env file in the project root:
GEMINI_API_KEY=your_api_key_herepython main.pyWhen prompted, provide a file path, for example:
examples/linear_search.py
The model returns:
overall_quality_summarygeneral_score(1 to 5)estimated_complexity(Big O)strengthsissuesimprovements
This repository includes 4 code samples:
examples/linear_search.pyexamples/two_sum_hashmap.pyexamples/search_in_sorted_array.pyexamples/bubble_sort.py
Try them with:
python main.py
# then type one of:
# examples/linear_search.py
# examples/two_sum_hashmap.py
# examples/bubble_sort.py