c1r3x commited on
Commit
e0de25c
Β·
verified Β·
1 Parent(s): aa300a4

updated the readme

Browse files
Files changed (1) hide show
  1. README.md +161 -13
README.md CHANGED
@@ -1,13 +1,161 @@
1
- ---
2
- title: Code Review Agent
3
- emoji: πŸ†
4
- colorFrom: yellow
5
- colorTo: green
6
- sdk: gradio
7
- sdk_version: 5.33.0
8
- app_file: app.py
9
- pinned: false
10
- short_description: An AI-powered code review agent that analyzes repositories f
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Code Review Agent
3
+
4
+ [![agent-demo-track](https://img.shields.io/badge/Gradio-agent--demo--track-orange)](https://huggingface.co/Agents-MCP-Hackathon)
5
+ [![MCP-Server](https://img.shields.io/badge/MCP-Server-blue)](https://www.gradio.app/guides/building-mcp-server-with-gradio)
6
+
7
+ A professional-grade code review agent that leverages AI to provide comprehensive code analysis and actionable recommendations. Built for the Gradio MCP Hackathon, this tool helps developers improve code quality through automated reviews powered by advanced AI models.
8
+
9
+ ![Gradio MCP Hackathon](https://cdn-thumbnails.huggingface.co/social-thumbnails/spaces/alvi15tooba/hackathon-gradio-app.png)
10
+
11
+ ## πŸš€ Features
12
+
13
+ - **Multi-Language Support**: Analyzes code in 15+ programming languages including Python, JavaScript, TypeScript, Java, C++, and more
14
+ - **Enterprise-Grade UI**: Professional Gradio interface with modern design and intuitive workflow
15
+ - **Advanced Analysis**: Comprehensive insights on security vulnerabilities, performance bottlenecks, and code quality issues
16
+ - **GitHub Integration**: Support for both public and private GitHub repositories with secure token authentication
17
+ - **MCP Server**: Functions as a Model Context Protocol (MCP) server, allowing LLMs to use this tool for code review operations
18
+ - **Professional Reporting**: Detailed reports with actionable recommendations organized by priority
19
+ - **Customizable Reviews**: Select specific languages to focus the review on parts of your codebase that matter most
20
+
21
+ ## πŸ—οΈ Architecture
22
+
23
+ The system follows a robust 4-layer architecture designed for extensibility and maintainability:
24
+
25
+ 1. **Presentation Layer**: Gradio-based UI with professional dashboard and intuitive controls
26
+ 2. **Application Layer**: Core business logic and review engine with modular components
27
+ 3. **Service Layer**: External integrations and analysis services with clean interfaces
28
+ 4. **MCP Layer**: Implements the Model Context Protocol (MCP) server functionality, allowing LLMs to use this tool for code review operations through standardized communication
29
+
30
+ ## πŸ“‹ Requirements
31
+
32
+ - Python 3.8+
33
+ - Git
34
+ - Internet connection for AI model access
35
+ - GitHub token (optional, for private repositories)
36
+
37
+ ## πŸ”§ Installation
38
+
39
+ ```bash
40
+ # Clone the repository
41
+ git clone https://github.com/cypher125/code-review-agent.git
42
+ cd code-review-agent
43
+
44
+ # Install dependencies
45
+ pip install -r requirements.txt
46
+
47
+ # Set up environment variables (optional)
48
+ cp sample.env .env
49
+ # Edit .env with your configuration
50
+ ```
51
+
52
+ ## πŸš€ Usage
53
+
54
+ ```bash
55
+ python src/main.py
56
+ ```
57
+
58
+ Then open your browser to http://localhost:7860 to access the Code Review Agent.
59
+
60
+ ### Analyzing a Repository
61
+
62
+ 1. Enter the GitHub repository URL in the input field
63
+ 2. Optionally enter your GitHub token for private repositories
64
+ 3. Select the programming languages to focus the review on
65
+ 4. Click "Submit" to start the analysis
66
+ 5. View the comprehensive report with actionable recommendations
67
+
68
+ ## 🐳 Docker Deployment
69
+
70
+ ```bash
71
+ # Build and run with Docker Compose
72
+ docker-compose up -d
73
+ ```
74
+
75
+ Access the application at http://localhost:7860
76
+
77
+ ## πŸ”Œ MCP Server Functionality
78
+
79
+ This application functions as a Model Context Protocol (MCP) server, allowing Large Language Models (LLMs) to use it as a tool for code review operations:
80
+
81
+ - **MCP Integration**: Exposes code review capabilities through standardized MCP endpoints
82
+ - **LLM Tool Usage**: Can be called by LLMs like Claude, GPT-4, and others that support the MCP protocol
83
+ - **Tool Operations**: Provides repository analysis, code review, and report generation as MCP operations
84
+ - **Structured Responses**: Returns analysis results in structured formats compatible with LLM processing
85
+
86
+ To use this as an MCP server with your LLM:
87
+
88
+ 1. Deploy the application using the instructions above
89
+ 2. Configure your MCP client to connect to the server endpoint
90
+ 3. The LLM can then use the code review capabilities through MCP tool calls
91
+
92
+ ## πŸ§ͺ Testing
93
+
94
+ ```bash
95
+ # Run the test suite
96
+ python -m pytest tests/
97
+ ```
98
+
99
+ ## πŸ“ Project Structure
100
+
101
+ ```
102
+ β”œβ”€β”€ .env # Environment variables configuration
103
+ β”œβ”€β”€ .gitignore # Git ignore file
104
+ β”œβ”€β”€ DEPLOYMENT_GUIDE.md # Guide for deploying to Hugging Face and Modal
105
+ β”œβ”€β”€ Dockerfile # Docker configuration
106
+ β”œβ”€β”€ LICENSE # MIT License file
107
+ β”œβ”€β”€ README.md # Project documentation
108
+ β”œβ”€β”€ app.py # Entry point for Hugging Face Spaces
109
+ β”œβ”€β”€ docker-compose.yml # Docker Compose configuration
110
+ β”œβ”€β”€ modal_deploy.py # Modal deployment configuration
111
+ β”œβ”€β”€ prompt.txt # AI prompt templates
112
+ β”œβ”€β”€ requirements.txt # Python dependencies
113
+ β”œβ”€β”€ run.py # Alternative entry script
114
+ β”œβ”€β”€ sample.env # Sample environment variables
115
+ β”œβ”€β”€ setup.py # Package setup configuration
116
+ β”œβ”€β”€ src/ # Source code directory
117
+ β”‚ β”œβ”€β”€ __init__.py # Package initialization
118
+ β”‚ β”œβ”€β”€ core/ # Core application logic
119
+ β”‚ β”‚ β”œβ”€β”€ __init__.py
120
+ β”‚ β”‚ β”œβ”€β”€ agent_manager.py # Agent orchestration
121
+ β”‚ β”‚ └── language_detector.py # Language detection
122
+ β”‚ β”œβ”€β”€ main.py # Main application entry point
123
+ β”‚ β”œβ”€β”€ mcp/ # MCP server implementation
124
+ β”‚ β”‚ β”œβ”€β”€ __init__.py
125
+ β”‚ β”‚ └── ai_review.py # AI review integration
126
+ β”‚ β”œβ”€β”€ services/ # Service layer components
127
+ β”‚ β”‚ β”œβ”€β”€ __init__.py
128
+ β”‚ β”‚ β”œβ”€β”€ code_analyzer.py # Code analysis
129
+ β”‚ β”‚ β”œβ”€β”€ performance_analyzer.py # Performance analysis
130
+ β”‚ β”‚ β”œβ”€β”€ report_generator.py # Report generation
131
+ β”‚ β”‚ β”œβ”€β”€ repository_service.py # Repository operations
132
+ β”‚ β”‚ └── security_scanner.py # Security scanning
133
+ β”‚ └── ui/ # User interface components
134
+ β”‚ β”œβ”€β”€ __init__.py
135
+ β”‚ β”œβ”€β”€ components/ # UI components
136
+ β”‚ β”œβ”€β”€ gradio_app.py # Gradio application
137
+ β”‚ └── styles/ # UI styling
138
+ └── tests/ # Test directory
139
+ β”œβ”€β”€ test_agent_manager.py
140
+ β”œβ”€β”€ test_ai_review.py
141
+ β”œβ”€β”€ test_code_analyzer.py
142
+ β”œβ”€β”€ test_language_detector.py
143
+ β”œβ”€β”€ test_performance_analyzer.py
144
+ β”œβ”€β”€ test_report_generator.py
145
+ β”œβ”€β”€ test_repository_service.py
146
+ └── test_security_scanner.py
147
+ ```
148
+
149
+ ## 🀝 Contributing
150
+
151
+ Contributions are welcome! Please feel free to submit a Pull Request.
152
+
153
+ 1. Fork the repository
154
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
155
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
156
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
157
+ 5. Open a Pull Request
158
+
159
+ ## πŸ“„ License
160
+
161
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.