Spaces:
Sleeping
Sleeping
Commit Β·
fd8fc09
1
Parent(s): a1a3fe3
Add HF Spaces metadata to README
Browse files
README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Ninja Code Guard
|
| 2 |
|
| 3 |
**Multi-agent code review system that reviews GitHub pull requests the way a senior engineering team would.**
|
|
@@ -6,7 +15,7 @@ Three specialized AI agents β Security, Performance, and Style β analyze you
|
|
| 6 |
|
| 7 |
## Screenshots
|
| 8 |
|
| 9 |
-
Screenshots available in the [GitHub repository
|
| 10 |
|
| 11 |
## How It Works
|
| 12 |
|
|
@@ -54,7 +63,7 @@ PR opened on GitHub
|
|
| 54 |
|-------|-----------|-----|
|
| 55 |
| LLM | Groq (Llama-3.3-70B) | 500+ tokens/sec, free 14.4K req/day |
|
| 56 |
| Agents | LangChain + Structured Output | Typed JSON responses, prompt templates |
|
| 57 |
-
| Backend | FastAPI
|
| 58 |
| Vector DB | ChromaDB + sentence-transformers | RAG context, semantic code search |
|
| 59 |
| Cache | Upstash Redis | Prevent duplicate reviews |
|
| 60 |
| Database | Neon Postgres | Review history, Health Score trends |
|
|
@@ -71,37 +80,23 @@ PR opened on GitHub
|
|
| 71 |
### Setup
|
| 72 |
|
| 73 |
```bash
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
cd ninja-code-guard
|
| 77 |
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
|
| 78 |
pip install -r requirements.txt
|
| 79 |
|
| 80 |
-
# Configure
|
| 81 |
cp .env.example .env
|
| 82 |
# Edit .env with your API keys
|
| 83 |
|
| 84 |
-
# Run
|
| 85 |
uvicorn app.main:app --reload --port 8000
|
| 86 |
```
|
| 87 |
|
| 88 |
-
### Environment Variables
|
| 89 |
-
|
| 90 |
-
```env
|
| 91 |
-
GROQ_API_KEY=gsk_...
|
| 92 |
-
GITHUB_APP_ID=123456
|
| 93 |
-
GITHUB_APP_PRIVATE_KEY_PATH=./keys/app.pem
|
| 94 |
-
GITHUB_WEBHOOK_SECRET=...
|
| 95 |
-
DATABASE_URL=postgresql://...
|
| 96 |
-
UPSTASH_REDIS_URL=rediss://...
|
| 97 |
-
```
|
| 98 |
-
|
| 99 |
## Architecture
|
| 100 |
|
| 101 |
**4 Layers:**
|
| 102 |
- **GitHub Layer** β Webhooks, PR events, inline comments
|
| 103 |
- **Orchestration Layer** β FastAPI, agent dispatch, asyncio.gather
|
| 104 |
-
- **Agent Layer** β 3 domain agents + synthesizer (LangChain
|
| 105 |
- **Knowledge Layer** β ChromaDB (RAG), Redis (cache), Postgres (history)
|
| 106 |
|
| 107 |
**Key Design Patterns:**
|
|
@@ -111,22 +106,10 @@ UPSTASH_REDIS_URL=rediss://...
|
|
| 111 |
- Background Tasks β Return 200 to GitHub immediately, review asynchronously
|
| 112 |
- Parallel Execution β asyncio.gather runs 3 agents concurrently
|
| 113 |
|
| 114 |
-
## Test Results
|
| 115 |
-
|
| 116 |
-
```
|
| 117 |
-
PR #4 on codeguard-test repo:
|
| 118 |
-
Security: 5 findings (SQL injection, weak crypto, hardcoded secrets)
|
| 119 |
-
Performance: 3 findings (O(nΒ²) loop, blocking I/O, high complexity)
|
| 120 |
-
Style: 6 findings (unused imports, magic numbers, bad naming)
|
| 121 |
-
Total: 14 findings
|
| 122 |
-
Health Score: 14/100
|
| 123 |
-
Latency: ~13 seconds (after model load)
|
| 124 |
-
```
|
| 125 |
-
|
| 126 |
## Running Tests
|
| 127 |
|
| 128 |
```bash
|
| 129 |
-
pytest tests/unit/ -v
|
| 130 |
```
|
| 131 |
|
| 132 |
## Project Structure
|
|
@@ -148,17 +131,21 @@ docs/ # Week-by-week documentation
|
|
| 148 |
|
| 149 |
## Documentation
|
| 150 |
|
| 151 |
-
Detailed week-by-week documentation
|
| 152 |
- [Week 1: Foundation & Setup](docs/WEEK1_FOUNDATION_AND_SETUP.md)
|
| 153 |
- [Week 2: GitHub Integration](docs/WEEK2_GITHUB_INTEGRATION.md)
|
| 154 |
- [Week 3: Security Agent](docs/WEEK3_SECURITY_AGENT.md)
|
| 155 |
- [Week 4: Performance Agent](docs/WEEK4_PERFORMANCE_AGENT.md)
|
| 156 |
- [Week 5: Style Agent](docs/WEEK5_STYLE_AGENT.md)
|
| 157 |
- [Week 6: RAG & Parallel Execution](docs/WEEK6_RAG_AND_PARALLEL.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
## License
|
| 160 |
|
| 161 |
-
|
| 162 |
|
| 163 |
---
|
| 164 |
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Ninja Code Guard
|
| 3 |
+
emoji: π‘οΈ
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
# Ninja Code Guard
|
| 11 |
|
| 12 |
**Multi-agent code review system that reviews GitHub pull requests the way a senior engineering team would.**
|
|
|
|
| 15 |
|
| 16 |
## Screenshots
|
| 17 |
|
| 18 |
+
Screenshots available in the [GitHub repository](https://github.com/ninjacode911/Project-Ninja-Code-Guard) β PR review comments, dashboard home, repo detail with health trends, and PR findings table.
|
| 19 |
|
| 20 |
## How It Works
|
| 21 |
|
|
|
|
| 63 |
|-------|-----------|-----|
|
| 64 |
| LLM | Groq (Llama-3.3-70B) | 500+ tokens/sec, free 14.4K req/day |
|
| 65 |
| Agents | LangChain + Structured Output | Typed JSON responses, prompt templates |
|
| 66 |
+
| Backend | FastAPI | Async, auto OpenAPI docs |
|
| 67 |
| Vector DB | ChromaDB + sentence-transformers | RAG context, semantic code search |
|
| 68 |
| Cache | Upstash Redis | Prevent duplicate reviews |
|
| 69 |
| Database | Neon Postgres | Review history, Health Score trends |
|
|
|
|
| 80 |
### Setup
|
| 81 |
|
| 82 |
```bash
|
| 83 |
+
git clone https://github.com/ninjacode911/Project-Ninja-Code-Guard
|
| 84 |
+
cd Project-Ninja-Code-Guard
|
|
|
|
| 85 |
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
|
| 86 |
pip install -r requirements.txt
|
| 87 |
|
|
|
|
| 88 |
cp .env.example .env
|
| 89 |
# Edit .env with your API keys
|
| 90 |
|
|
|
|
| 91 |
uvicorn app.main:app --reload --port 8000
|
| 92 |
```
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
## Architecture
|
| 95 |
|
| 96 |
**4 Layers:**
|
| 97 |
- **GitHub Layer** β Webhooks, PR events, inline comments
|
| 98 |
- **Orchestration Layer** β FastAPI, agent dispatch, asyncio.gather
|
| 99 |
+
- **Agent Layer** β 3 domain agents + synthesizer (LangChain)
|
| 100 |
- **Knowledge Layer** β ChromaDB (RAG), Redis (cache), Postgres (history)
|
| 101 |
|
| 102 |
**Key Design Patterns:**
|
|
|
|
| 106 |
- Background Tasks β Return 200 to GitHub immediately, review asynchronously
|
| 107 |
- Parallel Execution β asyncio.gather runs 3 agents concurrently
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
## Running Tests
|
| 110 |
|
| 111 |
```bash
|
| 112 |
+
pytest tests/unit/ -v # 92 tests
|
| 113 |
```
|
| 114 |
|
| 115 |
## Project Structure
|
|
|
|
| 131 |
|
| 132 |
## Documentation
|
| 133 |
|
| 134 |
+
Detailed week-by-week documentation in `docs/`:
|
| 135 |
- [Week 1: Foundation & Setup](docs/WEEK1_FOUNDATION_AND_SETUP.md)
|
| 136 |
- [Week 2: GitHub Integration](docs/WEEK2_GITHUB_INTEGRATION.md)
|
| 137 |
- [Week 3: Security Agent](docs/WEEK3_SECURITY_AGENT.md)
|
| 138 |
- [Week 4: Performance Agent](docs/WEEK4_PERFORMANCE_AGENT.md)
|
| 139 |
- [Week 5: Style Agent](docs/WEEK5_STYLE_AGENT.md)
|
| 140 |
- [Week 6: RAG & Parallel Execution](docs/WEEK6_RAG_AND_PARALLEL.md)
|
| 141 |
+
- [Week 7: Synthesizer](docs/WEEK7_SYNTHESIZER.md)
|
| 142 |
+
- [Week 8: Dashboard](docs/WEEK8_DASHBOARD.md)
|
| 143 |
+
- [Week 9: Polish & Evaluation](docs/WEEK9_POLISH_AND_EVALUATION.md)
|
| 144 |
+
- [Week 10: Deployment & Launch](docs/WEEK10_DEPLOYMENT_AND_LAUNCH.md)
|
| 145 |
|
| 146 |
## License
|
| 147 |
|
| 148 |
+
Apache 2.0
|
| 149 |
|
| 150 |
---
|
| 151 |
|