E5K7 commited on
Commit
6192537
·
1 Parent(s): ba7b9fb

docs: write extremely detailed README.md

Browse files
Files changed (1) hide show
  1. README.md +121 -16
README.md CHANGED
@@ -8,24 +8,129 @@ 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`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  pinned: false
9
  ---
10
 
11
+ <div align="center">
12
+ <h1>🔧 FixFlow</h1>
13
+ <p><b>Autonomous AI Agent for Automated Technical Due Diligence and Bug Resolution</b></p>
14
+
15
+ <p align="center">
16
+ <a href="#about">About</a> •
17
+ <a href="#features">Features</a> •
18
+ <a href="#architecture">Architecture</a> •
19
+ <a href="#how-it-works">How it Works</a> •
20
+ <a href="#quick-start">Quick Start</a> •
21
+ <a href="#deployment">Deployment</a>
22
+ </p>
23
+ </div>
24
 
25
+ ---
26
+
27
+ ## ⚡️ About FixFlow
28
+
29
+ FixFlow is a state-of-the-art **autonomous bug resolution agent** built for modern development workflows. Give FixFlow a GitHub repository URL and an Issue link, and it will handle the rest—from cloning the repository and deeply analyzing the architecture, to finding the root cause of the bug, generating the fixed code, and automatically opening a Pull Request.
30
+
31
+ Built using **Next.js**, **FastAPI**, and propelled by the intelligent reasoning capabilities of **GLM-4-Air** (Z.ai), FixFlow turns hours of debugging into a highly optimized, fully automated 3-minute process.
32
+
33
+ ---
34
+
35
+ ## ✨ Core Features
36
+
37
+ * 🌍 **Full-Viewport IDE Dashboard:** A beautiful, responsive 3-pane IDE layout featuring a live File Explorer, interactive Code Editor, and automated Issue Tracking.
38
+ * 🧠 **Deep Contextual Understanding:** FixFlow doesn't just read the issue; it navigates the repository file tree, fetching the exact files that define the bug's context.
39
+ * ⚡ **Lightning Fast:** Generates production-ready, peer-reviewed fixes in an average of 2-3 minutes.
40
+ * 📹 **Live SSE Streaming:** See the LLM's thought process and generated syntax mapped into the editor UI live, block-by-block.
41
+ * 🤖 **Autonomous PR Creation:** One click publishes the fix directly to your GitHub repository with a detailed changelog and explanation.
42
+ * 🔒 **Intelligent Rate Limiting:** Built-in semantic retry logic with exponential backoff and jitter designed specifically for autonomous API agents.
43
+
44
+ ---
45
+
46
+ ## 🏛 Architecture
47
+
48
+ FixFlow is split into a highly responsive client-side interface and a powerful Python-based agentic pipeline.
49
+
50
+ * **Frontend (Next.js 15, React, Vanilla CSS):** Handles the IDE state machine (LOADING, REPO_DASHBOARD, DONE), renders the file explorer, and streams Server-Sent Events (SSE) representing intermediate agent log steps.
51
+ * **Backend (FastAPI, Python 3.11):** Contains the orchestrator logic to traverse the repository, interface with the GitHub REST API, and communicate with the GLM API endpoints.
52
+ * **LLM Engine (GLM-4-Air):** The foundation of the logical reasoning. The agent forces the LLM to provide multi-step reasoning outputs ensuring accuracy across thousands of files.
53
+
54
+ ---
55
+
56
+ ## ⚙️ How the Agent Pipeline Works
57
+
58
+ FixFlow operates in a rigid, deterministic 5-step autonomous loop:
59
 
60
+ 1. **[1_ISSUE] Issue Understanding:** Fetches the open GitHub issue to decode the exact bug details, user complaints, and relevant environment variables.
61
+ 2. **[2_MAPPING] Repository Mapping:** Clones the repository file-tree. Leverages intelligent filtering to skip assets (e.g. `.png`) and dependencies (e.g. `node_modules`), zeroing in exclusively on source code logic.
62
+ 3. **[3_ANALYSIS] Root Cause Analysis:** Scans top suspected files and cross-references them against the issue, discovering precisely where the logic flaw or crash originated.
63
+ 4. **[4_FIX] Automated Generation:** Streams a live diff sequence overriding the broken logic with best-practice solutions.
64
+ 5. **[5_EXPLANATION] Documentation:** Outputs developer-friendly Markdown describing exactly *what* changed and *why*, generating a PR template.
65
 
66
+ ---
67
+
68
+ ## 🚀 Quick Start (Local Development)
69
+
70
+ ### 1. Prerequisites
71
+ - Node.js v20+
72
+ - Python 3.11+
73
+ - A valid **GitHub Personal Access Token (PAT)**
74
+ - A valid **Z.ai API Key (`GLM_API_KEY`)**
75
+
76
+ ### 2. Environment Setup
77
+ Create a `.env` file in the root directory:
78
+ ```env
79
+ GLM_API_KEY=your_zai_api_key_here
80
+ GITHUB_TOKEN=your_github_pat_here
81
+ GLM_MODEL=glm-4-air
82
+ ```
83
+
84
+ ### 3. Run the Backend (FastAPI)
85
+ ```bash
86
+ # Optional: Create a virtual environment
87
+ python -m venv venv
88
+ source venv/bin/activate
89
 
90
+ # Install dependencies
91
+ pip install -r requirements.txt
92
 
93
+ # Boot the API server
94
+ uvicorn backend.api:app --host 127.0.0.1 --port 8000
95
+ ```
96
+
97
+ ### 4. Run the Frontend (Next.js)
98
+ ```bash
99
+ # In a new terminal
100
+ cd frontend
101
+ npm install
102
+ npm run dev
103
+ ```
104
+
105
+ Open `http://localhost:3000` in your browser.
106
+
107
+ ---
108
+
109
+ ## 🐳 Deployment (Docker & Hugging Face Spaces)
110
+
111
+ FixFlow is fully configured for deployment on **Hugging Face Spaces (Docker SDK)**.
112
+
113
+ ### Running via unified Docker Container
114
+ The provided `Dockerfile` bundles the Python API and the Next.js React app, serving them via a `start.sh` job-control script. Next.js automatically rewrites `/api/*` traffic to the internal Python backend.
115
+
116
+ ```bash
117
+ docker build -t fixflow .
118
+ docker run -p 7860:7860 --env-file .env fixflow
119
+ ```
120
+
121
+ ### Deploying to Hugging Face
122
+ If deploying remotely to an empty HF Space:
123
+
124
+ 1. Create a dynamic HF Space with the **Docker** runtime.
125
+ 2. Ensure you have a Hugging Face Access Token with **Write** permissions.
126
+ 3. Configure `GLM_API_KEY` and `GITHUB_TOKEN` under your Space's *Variables & Secrets*.
127
+ 4. Push your codebase to the space:
128
+ ```bash
129
+ git remote add hf https://huggingface.co/spaces/<username>/<space-name>
130
+ git push https://<username>:<HF_TOKEN>@huggingface.co/spaces/<username>/<space-name> main --force
131
+ ```
132
+
133
+ ---
134
+ <div align="center">
135
+ <p><i>Autonomous bug fixing for the modern developer. Built during Hackathon.</i></p>
136
+ </div>