CodeSentinel now features a modern React + TypeScript frontend with a FastAPI backend, replacing the original Streamlit interface while maintaining all core functionality.
- Professional Design System - Clean, consistent interface using Tailwind CSS
- Responsive Layout - Works seamlessly on desktop, tablet, and mobile
- Real-time Updates - React Query for efficient data fetching and caching
- Type Safety - Full TypeScript coverage for reliability
- Dashboard - Overview with statistics and feature highlights
- Issue to PR - Transform GitHub issues into pull requests
- PR Ranking - Analyze and rank pull requests by quality metrics
- History - View past agent executions
- Settings - Configuration and API key status
- React 18 - Modern UI library
- TypeScript - Type-safe development
- Vite - Lightning-fast build tool
- TanStack Query - Server state management
- React Router - Client-side routing
- Tailwind CSS - Utility-first styling
- Axios - HTTP client with interceptors
- FastAPI - High-performance Python API framework
- Python 3.11 - Existing CodeSentinel logic
- Uvicorn - ASGI server
- Static File Serving - React build served from
/client/dist
-
Backend API (port 5000):
python server.py
-
Frontend Dev Server (port 5173 with API proxy, for development with hot reload):
cd client npm install npm run devNote: Dev server runs on port 5173 and proxies
/apirequests to the backend on port 5000.
The production build is automatically created and served by the FastAPI server:
# Build frontend
cd client
npm run build
# Start server (serves both API and React app)
cd ..
python server.py.
├── api_server.py # FastAPI backend with REST endpoints
├── server.py # Main entry point
├── agent_core.py # Issue-to-PR workflow logic
├── github_client.py # GitHub API integration (fork-based)
├── pr_scorer.py # PR ranking algorithm
├── gemini_ai.py # AI integration (Gemini 1.5 Flash)
├── validators.py # Code quality validation
├── storage.py # Run history persistence
├── config.py # Configuration and safety limits
│
└── client/ # React frontend
├── src/
│ ├── app/ # Router and providers
│ ├── components/ # Reusable UI components
│ │ ├── ui/ # Base components (Button, Card, etc.)
│ │ └── shared/ # AppShell, Navigation
│ ├── features/ # Page components
│ │ ├── dashboard/
│ │ ├── issue-to-pr/
│ │ ├── pr-ranking/
│ │ ├── history/
│ │ └── settings/
│ ├── lib/
│ │ ├── api/ # API client and modules
│ │ └── utils/ # Helper functions
│ └── styles/ # Global styles
├── dist/ # Production build (auto-generated)
├── package.json
├── tsconfig.json
├── vite.config.ts
└── tailwind.config.js
GET /api/health- Health checkGET /api/config- Get configuration statusGET /api/stats- Get usage statistics
POST /api/issue-to-pr- Create PR from issue{ "repo_url": "https://github.com/owner/repo", "issue_text": "Description of the issue", "base_branch": "main", "max_files": 10, "max_lines": 500 }
POST /api/pr-ranking- Rank pull requests{ "repo_url": "https://github.com/owner/repo" }
GET /api/runs?limit=20- Get recent runsGET /api/runs/{run_id}- Get run details
Required secrets (set via Replit Secrets or .env):
GEMINI_API_KEY- Google Gemini API keyGITHUB_TOKEN- GitHub personal access token
Configured in config.py:
- Maximum files changed per PR: 10
- Maximum lines changed per PR: 500
- Minimum lint score: 7.0
- Minimum maintainability index: 60
- Safe & Non-Intrusive - All changes happen in your fork
- Automatic Forking - Creates or reuses existing forks
- Clean PR Creation - PRs from fork to original repository
- Environment-Based Auth - Secure Git credential management
- Issue Diagnosis - Understands problems and affected files
- Fix Planning - Generates implementation strategies
- Code Generation - Creates patches with explanations
- Quality Scoring - Evaluates PR quality automatically
- Pylint - Code linting and static analysis
- Black - Code formatting checks
- Radon - Complexity and maintainability metrics
- Safety Checks - File/line change limits
- Navigate to Issue to PR page
- Enter repository URL:
https://github.com/owner/repo - Paste issue description
- Click "Run Agent & Create PR"
- Watch real-time progress
- Get PR link when complete
- Navigate to PR Ranking page
- Enter repository URL
- Click "Analyze PRs"
- View ranked list with scores
- See AI-generated recommendations
- Go to Settings page
- Check API key status
- Add missing keys via Replit Secrets
cd client
rm -rf node_modules package-lock.json
npm install
npm run build# Check if port 5000 is in use
lsof -i :5000
# Install dependencies
pip install fastapi uvicorn- Frontend Bundle: ~128 KB (gzipped)
- Initial Load: < 2s on fast connections
- API Response: < 100ms for most endpoints
- Build Time: ~9s for production build
Planned features:
- PR Details Page - View individual run details with diff viewer and patch inspection
- Click through from History page to see full run artifacts
- Side-by-side diff view for code changes
- Validation results and AI reasoning
- Repositories Management - Manage watched repos and whitelist
- Advanced Filtering - Filter runs by status, date, repository
- Real-time Notifications - Toast notifications for run completion
- Webhook Integration - Auto-trigger on new issues
- Multi-Repository Dashboard - Monitor multiple repos
- Custom Scoring Weights - Adjust PR ranking algorithm
- Role-Based Access Control - Team collaboration features
Note: The current React implementation provides all core functionality of the original Streamlit UI (Issue to PR workflow, PR Ranking, Run History, Configuration). PR Details is the main feature enhancement planned for the next iteration.
- Create API endpoint in
api_server.py - Add API module in
client/src/lib/api/modules/ - Create React component in
client/src/features/ - Add route to
client/src/app/router.tsx - Build and test
- Backend: Black formatting, type hints
- Frontend: ESLint, Prettier, TypeScript strict mode
- Components: Functional components with hooks
- Styling: Tailwind CSS utility classes
This is a hackathon project demonstrating AI-assisted development. The codebase serves as a reference for:
- FastAPI + React integration
- AI-powered code generation
- GitHub automation
- Type-safe API design
See parent repository for license information.
- Gemini 1.5 Flash - AI reasoning and code generation
- GitHub API - Repository and PR management
- React Ecosystem - Modern frontend development
- FastAPI - High-performance Python APIs
Built with ❤️ for the Agentverse Hackathon