RepoGuardian is a next-generation multi-agent fullstack application designed to audit, explore, and automatically repair software repositories. By chaining together six distinct AI agents, it clones a target repository, runs it in a sandboxed runtime environment to capture live logs/errors (via Playwright), maps runtime issues back to source lines, conducts security/architectural audits, and generates complete, push-ready pull requests for fixes.
RepoGuardian uses an orchestrator pattern to coordinate six specialized AI agents that run in sequence.
ββββββββββββββββββββββββ
β Target GitHub Repo β
ββββββββββββ¬ββββββββββββ
β (Clone)
βΌ
βββββββββββββββββββ
β Scanner Agent β βββΊ Framework & dependency analysis
ββββββββββ¬βββββββββ
βΌ
βββββββββββββββββββ
β Explorer Agent β βββΊ Installs dependencies & runs sandboxed app
ββββββββββ¬βββββββββ (Captures console errors & screenshot via Playwright)
βΌ
βββββββββββββββββββ
β Auditor Agent β βββΊ Maps captured console errors to specific
ββββββββββ¬βββββββββ source code files and line numbers
βΌ
βββββββββββββββββββ
β Architect Agent β βββΊ Audits security & performance anomalies
ββββββββββ¬βββββββββ (Hardcoded keys, API vulnerabilities, etc.)
βΌ
βββββββββββββββββββ
β Executor Agent β βββΊ Generates precise code diffs & submits
ββββββββββ¬βββββββββ GitHub PR (upon user approval)
βΌ
βββββββββββββββββββ
β Market Agent β βββΊ Analyzes market potential & viability
βββββββββββββββββββ
| Agent Name | Primary Role | Core Technologies / Models |
|---|---|---|
| Scanner Agent | Inspects repository layouts, readme files, and package.json configurations to identify the application framework and launch command. |
Gemini API, Python AST |
| Explorer Agent | Boots the app in a sandboxed background environment and navigates through the pages using headless browsers. | Playwright, Node Subprocess |
| Auditor Agent | Correlates raw front-end or server-side console errors back to structural lines of source code. | Gemini API, Contextual Diffs |
| Architect Agent | Analyzes the static codebase for security loopholes (e.g. exposed credentials) and architecture anti-patterns. | Gemini API, Static RegEx Scanner |
| Executor Agent | Produces code adjustments and publishes a clean Git branch + Pull Request to the origin repository. | GitPython, PyGithub, Gemini API |
| Market Agent | Analyzes market potential, viability, and competitive landscape of the repository. | Gemini API, Startup Strategist Prompt |
- 6th Agent - Market Agent ("The Strategist"): Analyzes startup roadmap, market size, audience segments, competitor advantages/weaknesses, and gives a project viability score.
- Enhanced Security & Health Scores: Multi-factor scoring across codebase health, quality, maintainability, documentation, and security (graded out of 100).
- Interactive Next.js Dashboard:
- Live Trace: Real-time SSE logs streamed directly from the agent pipelines.
- Browser Tab: Visualizes console logs and takes live baseline screenshots of the booted app.
- Issues & Fixes: A code diff viewer to review, modify, and push AI-generated repairs.
- Security Audit Tab: Provides deep scans of credential exposures and PII leaks.
- Market intelligence Tab: Details competitor pricing models, unique market gaps, and risk mitigation strategies.
- Backend: FastAPI (Python 3.9+), Uvicorn, Playwright (Headless Browser Automation), PyGithub, GitPython, Google Generative AI (Gemini SDK).
- Frontend: Next.js (App Router, v14), TypeScript, Tailwind CSS, Axios, React Diff Viewer.
- Database (Optional): Supabase (PostgreSQL) for job persistence and PR history.
Follow these steps to configure and run RepoGuardian on your local machine.
Make sure you have the following software installed:
- Python 3.9+ (Check with
python --version) - Node.js 18+ (Check with
node --version) - Git (Check with
git --version)
-
Open your terminal and navigate to the
backendfolder:cd backend -
Create a Python virtual environment:
python -m venv venv
-
Activate the virtual environment:
- Windows (Command Prompt):
venv\Scripts\activate
- Windows (PowerShell):
.\venv\Scripts\Activate.ps1
- macOS / Linux:
source venv/bin/activate
- Windows (Command Prompt):
-
Install python dependencies:
pip install -r requirements.txt
-
Install the required Playwright browser binaries:
playwright install chromium
-
Configure your environment variables. Copy
.env.exampleto.env:copy .env.example .env
Open backend/.env and populate the following keys:
GEMINI_API_KEY: Your Google Gemini API Key.GITHUB_TOKEN: A GitHub Personal Access Token (classic or fine-grained) with permissions to clone repos and write Pull Requests.SUPABASE_URL/SUPABASE_SERVICE_KEY: Optional Supabase config if you wish to run with SQL database persistence.
-
Start the FastAPI development server:
uvicorn main:app --reload --port 8000
The backend API will now be live at
http://localhost:8000.
-
Open a new terminal window and navigate to the
frontendfolder:cd frontend -
Install the frontend dependencies:
npm install
-
Configure environment variables. Copy
.env.local.exampleto.env.local:copy .env.local.example .env.local
Ensure the following variable matches your backend URI:
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
-
Launch the Next.js development server:
npm run dev
The frontend application will now be running at
http://localhost:3000.
If you are on Windows, you can start both servers simultaneously using the utility batch script at the project root:
.\run.batThis script will open two separate command prompt windows running the FastAPI server and the Next.js server respectively.
Warning
Ensure you have activated your virtual environment and run pip install in backend, and npm install in frontend before invoking the batch file.
To make testing easier, a demo application (demo-broken-app) has been provided at the project root, along with a python utility script (create_demo_repo.py) to host it on your own GitHub account.
- Configure
backend/.envwith yourGITHUB_TOKEN. - Run the creation script:
python create_demo_repo.py
- This script will automatically create a public repository called
demo-broken-appon your GitHub account and push the demo codebase to it. - Copy the URL of your new repository and paste it into the search bar in the RepoGuardian UI to run a full scanning cycle!
If you configure Supabase persistence, deploy the SQL schema by running the script located in supabase/schema.sql inside your Supabase SQL Editor:
- Log in to the Supabase Console and open your project.
- Go to the SQL Editor tab.
- Click New Query, paste the contents of schema.sql, and click Run.
- Set
SUPABASE_URLandSUPABASE_SERVICE_KEYin thebackend/.envfile.
RepoGuardian/
βββ backend/ # FastAPI Application
β βββ agents/ # Multi-Agent implementation modules
β β βββ scanner.py # Framework detection agent
β β βββ explorer.py # Runtime execution & error capture agent
β β βββ auditor.py # Error trace-mapping agent
β β βββ architect.py # Static code & safety review agent
β β βββ executor.py # Git Branch & PR creation agent
β β βββ market_agent.py # Market viability & strategist agent
β βββ main.py # REST Endpoints
β βββ orchestrator.py # Sequential execution controller
β βββ db.py # Supabase communication layer
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment placeholder vars
βββ frontend/ # Next.js Application
β βββ app/ # App Router views (dashboard, analyze trace, etc.)
β βββ components/ # UI elements (Agent status cards, inputs)
β βββ lib/ # Client connectors (Supabase, API callers)
β βββ package.json # Node dependencies
β βββ .env.local.example # UI config variables
βββ supabase/
β βββ schema.sql # DB SQL table schema definitions
βββ run.bat # Dual-server startup script
βββ README.md # Project guide & instructions
When contributing to this project, adhere to the following architectural patterns:
- UTF-8 Output Stream Safety: On Windows systems, always ensure CLI streams are reconfigured to support UTF-8 (as done in
main.pyandrun_job.pyviasys.stdout.reconfigure(encoding='utf-8')). - State Isolation: Backend operations are transient and run in a random temporary folder (
tempfile.mkdtemp(prefix="architect_")) to keep multiple jobs from overriding each other. - Pydantic Validation: Define request bodies under typed Pydantic models (e.g.
AnalyzeRequest) in the backend to ensure automatic OpenAPI serialization. - Tailwind Styling: Components in the frontend use Tailwind classes with modular transitions (like
transition-all duration-300) to create premium, interactive UI card highlights (see AgentCard.tsx).