"Point it at any Python repo. It writes, runs, and fixes unit tests for you β automatically."
- Problem Statement
- Our Solution
- Key Features
- How It Works
- Tech Stack
- Architecture
- Installation & Setup
- API Reference
- Challenges & Learnings
- Future Enhancements
- Team Members
- License
Writing unit tests is one of the most critical yet time-consuming tasks in software development. Developers often skip it due to time pressure, unfamiliarity, or the complexity of the codebase. This leads to:
- Low code coverage, hiding bugs until they reach production.
- Slow development cycles, with manual QA taking up enormous time.
- Technical debt that compounds as projects scale.
There was no tool that could look at an arbitrary Python codebase and automatically produce a passing, high-coverage unit test suite β until now.
Antigravity AI is a full-stack web application that takes a GitHub repository URL as input and uses Google Gemini 1.5 Flash to autonomously:
- Clone the repository.
- Identify the most logic-rich Python file.
- Generate a complete unit test file.
- Execute the tests and capture failures.
- Repair broken tests using AI reasoning on the failure logs.
- Repeat until all tests pass.
- Save the final test suite and code coverage to the user's dashboard.
No manual coding. No test writing. Just a GitHub link.
| Feature | Description |
|---|---|
| π€ AI Test Generation | Gemini 1.5 Flash reads source code and writes contextually accurate unit tests |
| π Self-Healing Loop | If tests fail, the AI reads the error output and auto-repairs them (up to 5 cycles) |
| π Coverage Tracking | Real-time code coverage % extracted using pytest-cov |
| π Premium Live UI | Glassmorphism design with real-time log streaming via Server-Sent Events |
| π User Authentication | Secure multi-user system with JWT sessions and bcrypt-hashed passwords |
| ποΈ Private Workspaces | Each user has an isolated dashboard of all their past test generation runs |
| π History & Reports | Every generated test suite is persistently stored for review and download |
GitHub URL Input
β
βΌ
1. Clone Repository (GitPython)
β
βΌ
2. Scan & Select Best Python File
(largest non-test source file)
β
βΌ
3. Gemini AI Analyzes Source Code
β Generates Full Unit Test File
β
βΌ
4. Execute Tests (Pytest + Coverage)
β
Pass? ββββ YES βββββββββββββββββββββββββββ
β β
NO β
β β
5. AI Reads Failure Logs & Repairs Tests β
β β
6. Loop (max 5 iterations) β
β β
ββββββββββββββββββββββββββββββββββββββββ
β
βΌ
7. Final Report Generated
β Coverage % + Test Code Saved to DB
β Displayed in User Dashboard
| Technology | Role |
|---|---|
| FastAPI | High-performance REST API & Server-Sent Events |
| Google Gemini 1.5 Flash | Core AI for test generation and self-repair |
| SQLModel + SQLite | ORM-based persistent storage for users and tasks |
| Pytest + pytest-cov | Test execution engine & coverage measurement |
| python-jose + passlib | JWT authentication & bcrypt password hashing |
| GitPython | Programmatic GitHub repository cloning |
| python-dotenv | Secure environment variable management |
| Technology | Role |
|---|---|
| React.js (Vite) | Modern reactive UI framework |
| Vanilla CSS | Custom glassmorphism design system |
| Server-Sent Events (SSE) | Real-time log streaming from agent to browser |
| localStorage | Persistent JWT session management |
βββββββββββββββββββββββ ββββββββββββββββββββββββββ
β React Frontend β ββSSEββ β FastAPI Backend β
β β β β
β β’ Auth (Sign In/Up)β βββββββ β β’ JWT Auth β
β β’ Repo URL Input β β β’ SQLite DB β
β β’ Live Terminal β β β’ Task Queue (async) β
β β’ History View β β β’ Git Cloning β
βββββββββββββββββββββββ ββββββββββββ¬ββββββββββββββ
β
βΌ
ββββββββββββββββββββββββ
β AI Agent (agent.py)β
β β
β β’ Gemini API Calls β
β β’ Pytest Execution β
β β’ Repair Loop β
ββββββββββββββββββββββββ
- Python 3.10+
- Node.js & npm
- Git
- A free Google Gemini API key β Get one here
git clone https://github.com/sohail9972/Antigravity_Application.git
cd Antigravity_Applicationcd backend
pip install -r requirements.txtcd ../frontend
npm installCreate backend/.env with:
GOOGLE_API_KEY=your_gemini_api_key_here
JWT_SECRET=any_random_secret_string# Run from the root project directory
python start_app.pyOpen: http://localhost:5173
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/api/auth/register |
β | Register a new user |
POST |
/api/auth/login |
β | Login and receive JWT token |
GET |
/api/auth/me |
β | Get current authenticated user |
POST |
/api/analyze |
β | Trigger test generation for a repo |
GET |
/api/stream/{task_id} |
β | Stream live AI agent logs (SSE) |
GET |
/api/tasks |
β | View all past analysis sessions |
GET |
/api/tasks/{task_id} |
β | Get full details of a specific run |
DELETE |
/api/tasks/{task_id} |
β | Remove a task from history |
- Server Reloads Killing Sessions: Uvicorn's
--reloadmode was restarting the server every time a new repo was cloned (since the files landed inside thebackend/folder). Fixed by moving the workspace directory outside the watched directory. - Gemini JSON Mode: Prompted the model with
response_mime_type: "application/json"for structured, reliable output. Built a fallback JSON extractor for edge cases. - Multi-user Isolation: Linking every analysis task to a specific user ID in the database ensures full workspace isolation between accounts.
- Real-time Streaming: Used FastAPI's
StreamingResponsewithtext/event-streamto push live log messages to the browser without polling.
- File Browser: Let the user manually select which file in the repo to test, instead of auto-selection.
- Multi-language Support: Extend beyond Python to support JavaScript, Java, and Go.
- GitHub OAuth: One-click login via GitHub account for seamless repo access.
- PR Integration: Automatically open a Pull Request in the target repository with the generated test file.
- Export Reports: Download the full analysis report as a Markdown or PDF document.
- Test Quality Scoring: Use a secondary AI pass to assess test quality beyond just pass/fail.
| Name | Role |
|---|---|
| Sohail | Full-Stack Developer & AI Integration Lead |
- Google AI (Gemini 1.5 Flash) for the powerful and affordable AI backbone.
- FastAPI for making async Python backends a joy to build.
- Hack2Skill for organizing a hackathon that encourages real-world, impactful AI solutions.
This project is licensed under the MIT License.
π’ Active β Core features complete. Submitted for Hack2Skill 2026.