Spaces:
Running
Running
docs: add huggingface spaces yaml metadata
Browse files
README.md
CHANGED
|
@@ -1,179 +1,31 @@
|
|
| 1 |
-
# 🔧 FixFlow — Autonomous Bug Resolution Agent
|
| 2 |
-
|
| 3 |
-
<div align="center">
|
| 4 |
-
|
| 5 |
-
[](https://python.org)
|
| 6 |
-
[](https://streamlit.io)
|
| 7 |
-
[](https://open.bigmodel.cn)
|
| 8 |
-
[](LICENSE)
|
| 9 |
-
|
| 10 |
-
**Give FixFlow a GitHub issue. Get back a root cause analysis + a PR-ready fix.**
|
| 11 |
-
|
| 12 |
-
*Built with GLM 5.1 by Z.ai ⚡*
|
| 13 |
-
|
| 14 |
-
</div>
|
| 15 |
-
|
| 16 |
-
---
|
| 17 |
-
|
| 18 |
-
## ✨ Features
|
| 19 |
-
|
| 20 |
-
| Feature | Description |
|
| 21 |
-
|---------|-------------|
|
| 22 |
-
| 🐛 **Smart Issue Parsing** | Extracts error messages, reproduction steps, and technical clues from any GitHub issue |
|
| 23 |
-
| 🗺️ **Codebase Mapping** | Identifies the top 5-10 most suspect files from the entire repo tree |
|
| 24 |
-
| 🧠 **Chain-of-Thought Reasoning** | Traces execution flow step-by-step, citing file names, functions, and line numbers |
|
| 25 |
-
| 🔬 **Root Cause Analysis** | Pinpoints the exact bug location with high-confidence reasoning |
|
| 26 |
-
| 🔧 **Fix Generation** | Generates minimal, precise code changes as unified diffs |
|
| 27 |
-
| 📝 **PR Description** | Writes a complete, reviewer-friendly pull request description |
|
| 28 |
-
| 🎯 **Confidence Score** | Optional self-evaluation step where GLM rates its own certainty |
|
| 29 |
-
| 📤 **Export** | Download the full analysis report as Markdown or the patch as `.diff` |
|
| 30 |
-
|
| 31 |
-
---
|
| 32 |
-
|
| 33 |
-
## 🚀 Quick Start
|
| 34 |
-
|
| 35 |
-
### 1. Clone & Install
|
| 36 |
-
|
| 37 |
-
```bash
|
| 38 |
-
git clone https://github.com/your-username/fixflow.git
|
| 39 |
-
cd fixflow
|
| 40 |
-
|
| 41 |
-
# Create virtual environment
|
| 42 |
-
python -m venv .venv
|
| 43 |
-
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
| 44 |
-
|
| 45 |
-
# Install dependencies
|
| 46 |
-
pip install -r requirements.txt
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
### 2. Configure API Keys
|
| 50 |
-
|
| 51 |
-
```bash
|
| 52 |
-
cp .env.example .env
|
| 53 |
-
```
|
| 54 |
-
|
| 55 |
-
Edit `.env`:
|
| 56 |
-
|
| 57 |
-
```env
|
| 58 |
-
GLM_API_KEY=your_glm_api_key_here # Get from https://open.bigmodel.cn/
|
| 59 |
-
GITHUB_TOKEN=ghp_your_token_here # Optional, but recommended
|
| 60 |
-
GLM_MODEL=glm-5-plus
|
| 61 |
-
```
|
| 62 |
-
|
| 63 |
-
### 3. Run
|
| 64 |
-
|
| 65 |
-
```bash
|
| 66 |
-
streamlit run app.py
|
| 67 |
-
```
|
| 68 |
-
|
| 69 |
-
Open [http://localhost:8501](http://localhost:8501) 🎉
|
| 70 |
-
|
| 71 |
-
---
|
| 72 |
-
|
| 73 |
-
## 🔄 How It Works
|
| 74 |
-
|
| 75 |
-
```
|
| 76 |
-
GitHub Issue URL
|
| 77 |
-
│
|
| 78 |
-
▼
|
| 79 |
-
┌─────────────────┐
|
| 80 |
-
│ 1. Parse Issue │ ─── Extract: error, repro steps, affected components
|
| 81 |
-
└────────┬────────┘
|
| 82 |
-
│
|
| 83 |
-
▼
|
| 84 |
-
┌─────────────────┐
|
| 85 |
-
│ 2. Map Codebase │ ─── Scan repo tree → Rank top 5-10 suspect files
|
| 86 |
-
└────────┬────────┘
|
| 87 |
-
│
|
| 88 |
-
▼
|
| 89 |
-
┌─────────────────┐
|
| 90 |
-
│ 3. Analyze Code │ ─── Read files → Chain-of-thought root cause tracing
|
| 91 |
-
└────────┬────────┘
|
| 92 |
-
│
|
| 93 |
-
▼
|
| 94 |
-
┌─────────────────┐
|
| 95 |
-
│ 4. Generate Fix │ ─── Produce corrected file versions (minimal changes)
|
| 96 |
-
└────────┬────────┘
|
| 97 |
-
│
|
| 98 |
-
▼
|
| 99 |
-
┌─────────────────┐
|
| 100 |
-
│ 5. Write PR │ ─── Unified diff + human-readable PR description
|
| 101 |
-
└─────────────────┘
|
| 102 |
-
│
|
| 103 |
-
▼
|
| 104 |
-
📄 Full Report + 📦 Patch File
|
| 105 |
-
```
|
| 106 |
-
|
| 107 |
-
---
|
| 108 |
-
|
| 109 |
-
## 🧪 Example Output
|
| 110 |
-
|
| 111 |
-
See [`demo/example_output.md`](demo/example_output.md) for a full sample analysis on a real FastAPI issue.
|
| 112 |
-
|
| 113 |
-
Quick preview:
|
| 114 |
-
|
| 115 |
-
```
|
| 116 |
-
🔬 Root Cause:
|
| 117 |
-
In fastapi/_compat.py ~line 215, _get_value() calls model_dump()
|
| 118 |
-
without passing `include=include` in the Pydantic v2 branch.
|
| 119 |
-
The fix: add include=include, exclude=exclude to model_dump().
|
| 120 |
-
```
|
| 121 |
-
|
| 122 |
---
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
│ ├── __init__.py
|
| 131 |
-
│ ├── config.py # API keys, model config, constants
|
| 132 |
-
│ ├── github_client.py # Fetch issues, repo trees, file contents
|
| 133 |
-
│ ├── code_indexer.py # Parse repo structure, format for LLM
|
| 134 |
-
│ ├── agent.py # Core 5-step reasoning agent orchestrator
|
| 135 |
-
│ ├── prompts.py # All LLM prompt templates
|
| 136 |
-
│ ├── diff_generator.py # Generate unified diffs from proposed changes
|
| 137 |
-
│ └── llm_client.py # GLM 5.1 API wrapper (sync + streaming)
|
| 138 |
-
├── requirements.txt
|
| 139 |
-
├── .env.example
|
| 140 |
-
├── README.md
|
| 141 |
-
└── demo/
|
| 142 |
-
└── example_output.md # Sample output for showcase
|
| 143 |
-
```
|
| 144 |
-
|
| 145 |
---
|
| 146 |
|
| 147 |
-
#
|
| 148 |
-
|
| 149 |
-
| Variable | Default | Description |
|
| 150 |
-
|----------|---------|-------------|
|
| 151 |
-
| `GLM_API_KEY` | — | Your Z.ai API key (required) |
|
| 152 |
-
| `GITHUB_TOKEN` | — | GitHub PAT (optional, recommended) |
|
| 153 |
-
| `GLM_MODEL` | `glm-5-plus` | GLM model to use |
|
| 154 |
-
| `GLM_BASE_URL` | `https://open.bigmodel.cn/api/paas/v4` | API endpoint |
|
| 155 |
-
| `MAX_FILES_TO_SCAN` | `100` | Max files to include in repo scan |
|
| 156 |
-
| `MAX_FILE_SIZE_BYTES` | `51200` | Max file size to read (50 KB) |
|
| 157 |
|
| 158 |
-
-
|
| 159 |
|
| 160 |
-
##
|
| 161 |
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
## 📝 License
|
| 171 |
-
|
| 172 |
-
MIT License — see [LICENSE](LICENSE) for details.
|
| 173 |
-
|
| 174 |
-
---
|
| 175 |
|
| 176 |
-
|
| 177 |
-
Built with ❤️ for the Z.ai GLM 5.1 Hackathon<br>
|
| 178 |
-
<b>Powered by GLM 5.1 by Z.ai ⚡</b>
|
| 179 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Fixflow
|
| 3 |
+
emoji: 🔧
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: red
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# FixFlow - Autonomous Repository Agent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
FixFlow analyzes your repository, understands issues deeply, and generates production-ready fixes with pull requests—all automatically.
|
| 14 |
|
| 15 |
+
## Running Locally
|
| 16 |
|
| 17 |
+
1. Create a `.env` file with `GLM_API_KEY` and `GITHUB_TOKEN`.
|
| 18 |
+
2. Start the FastAPI backend:
|
| 19 |
+
```bash
|
| 20 |
+
uvicorn backend.api:app --host 127.0.0.1 --port 8000
|
| 21 |
+
```
|
| 22 |
+
3. Start the Next.js frontend:
|
| 23 |
+
```bash
|
| 24 |
+
cd frontend
|
| 25 |
+
npm install
|
| 26 |
+
npm run dev
|
| 27 |
+
```
|
| 28 |
|
| 29 |
+
## Deploying
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
This project is configured to run fully containerized on Hugging Face Spaces using the provided `Dockerfile` and `start.sh`.
|
|
|
|
|
|
|
|
|