fixfleet 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. fixfleet-0.3.0/LICENSE +21 -0
  2. fixfleet-0.3.0/PKG-INFO +349 -0
  3. fixfleet-0.3.0/README.md +299 -0
  4. fixfleet-0.3.0/bugfixer/__init__.py +6 -0
  5. fixfleet-0.3.0/bugfixer/backends/__init__.py +1 -0
  6. fixfleet-0.3.0/bugfixer/backends/_subprocess.py +82 -0
  7. fixfleet-0.3.0/bugfixer/backends/api/__init__.py +1 -0
  8. fixfleet-0.3.0/bugfixer/backends/api/openai_compat.py +183 -0
  9. fixfleet-0.3.0/bugfixer/backends/base.py +52 -0
  10. fixfleet-0.3.0/bugfixer/backends/cli/__init__.py +1 -0
  11. fixfleet-0.3.0/bugfixer/backends/cli/aider.py +25 -0
  12. fixfleet-0.3.0/bugfixer/backends/cli/claude.py +22 -0
  13. fixfleet-0.3.0/bugfixer/backends/cli/codex.py +20 -0
  14. fixfleet-0.3.0/bugfixer/backends/cli/cursor.py +19 -0
  15. fixfleet-0.3.0/bugfixer/backends/cli/gemini.py +20 -0
  16. fixfleet-0.3.0/bugfixer/backends/cli/qwen.py +19 -0
  17. fixfleet-0.3.0/bugfixer/backends/registry.py +87 -0
  18. fixfleet-0.3.0/bugfixer/budget.py +119 -0
  19. fixfleet-0.3.0/bugfixer/cli.py +649 -0
  20. fixfleet-0.3.0/bugfixer/confidence.py +232 -0
  21. fixfleet-0.3.0/bugfixer/config.py +59 -0
  22. fixfleet-0.3.0/bugfixer/gitlab.py +158 -0
  23. fixfleet-0.3.0/bugfixer/locator.py +273 -0
  24. fixfleet-0.3.0/bugfixer/parser.py +181 -0
  25. fixfleet-0.3.0/bugfixer/prompt.py +155 -0
  26. fixfleet-0.3.0/bugfixer/state.py +71 -0
  27. fixfleet-0.3.0/bugfixer/ui.py +90 -0
  28. fixfleet-0.3.0/fixfleet.egg-info/PKG-INFO +349 -0
  29. fixfleet-0.3.0/fixfleet.egg-info/SOURCES.txt +33 -0
  30. fixfleet-0.3.0/fixfleet.egg-info/dependency_links.txt +1 -0
  31. fixfleet-0.3.0/fixfleet.egg-info/entry_points.txt +3 -0
  32. fixfleet-0.3.0/fixfleet.egg-info/top_level.txt +1 -0
  33. fixfleet-0.3.0/pyproject.toml +57 -0
  34. fixfleet-0.3.0/setup.cfg +4 -0
  35. fixfleet-0.3.0/tests/test_all.py +560 -0
fixfleet-0.3.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yash Koladiya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,349 @@
1
+ Metadata-Version: 2.4
2
+ Name: fixfleet
3
+ Version: 0.3.0
4
+ Summary: Auto-fix GitLab bugs with AI agents โ€” bring your own CLI or free API.
5
+ Author: Yash Koladiya
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Yash Koladiya
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/Yash-Koladiya30/fixfleet
29
+ Project-URL: Repository, https://github.com/Yash-Koladiya30/fixfleet
30
+ Project-URL: Issues, https://github.com/Yash-Koladiya30/fixfleet/issues
31
+ Keywords: gitlab,ai-agent,bug-fixer,claude-code,codex,gemini,cursor,aider,ollama,groq,openrouter,agentic-ai,automation,cli-tool,developer-tools
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Environment :: Console
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python :: 3
38
+ Classifier: Programming Language :: Python :: 3.9
39
+ Classifier: Programming Language :: Python :: 3.10
40
+ Classifier: Programming Language :: Python :: 3.11
41
+ Classifier: Programming Language :: Python :: 3.12
42
+ Classifier: Programming Language :: Python :: 3.13
43
+ Classifier: Topic :: Software Development :: Bug Tracking
44
+ Classifier: Topic :: Software Development :: Quality Assurance
45
+ Classifier: Topic :: Utilities
46
+ Requires-Python: >=3.9
47
+ Description-Content-Type: text/markdown
48
+ License-File: LICENSE
49
+ Dynamic: license-file
50
+
51
+ <div align="center">
52
+
53
+ # ๐Ÿš€ FixFleet
54
+
55
+ ### **Auto-fix GitLab bugs with AI agents โ€” bring your own CLI or free API.**
56
+
57
+ *Reads open `Bug` issues from GitLab โ†’ parses stack traces and steps โ†’ pre-narrows the search to relevant files โ†’ dispatches to your AI agent of choice โ†’ scores the fix's confidence. All locally. No commits. No lock-in.*
58
+
59
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
60
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
61
+ [![Tests](https://img.shields.io/badge/tests-54%20passing-brightgreen.svg)](#-testing)
62
+ [![Stdlib only](https://img.shields.io/badge/dependencies-stdlib%20only-success.svg)](#-quick-start)
63
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](#-contributing)
64
+
65
+ **One command. Any AI. Zero waste.**
66
+
67
+ `Claude Code` ยท `Codex` ยท `Gemini CLI` ยท `Cursor Agent` ยท `Aider` ยท `Qwen Code` ยท `Groq` ยท `Gemini API` ยท `OpenRouter` ยท `Cerebras` ยท `Ollama` ยท `LM Studio`
68
+
69
+ </div>
70
+
71
+ ---
72
+
73
+ > ๐ŸŽฏ **What this tool does in one sentence:**
74
+ > *Pulls open bug tickets from GitLab, hands each one to an AI coding agent with the right context already pre-loaded, and scores how confident the fix is โ€” so you only review the ones worth reviewing.*
75
+
76
+ Built by **Yash Koladiya**.
77
+
78
+ ---
79
+
80
+ ## โœจ What it does
81
+
82
+ 1. Fetches **open issues with the `Bug` label** from any GitLab project (gitlab.com or self-hosted).
83
+ 2. Parses each issue body โ€” pulling out **Description, Steps to Reproduce, Expected/Actual behavior, Logs, Stack Traces** automatically.
84
+ 3. Pre-narrows the search space: extracts file paths, stack frames, symbols โ†’ **ranks candidate files in your local repo** so the AI doesn't waste tokens hunting.
85
+ 4. Dispatches the structured prompt to your chosen AI agent (CLI or API).
86
+ 5. Computes a **confidence score** for the fix using diff metrics + model self-rating + hedge-density.
87
+ 6. Tracks **token usage per backend per day** so you don't blow through paid quotas.
88
+ 7. **Never commits or pushes** โ€” leaves the working tree dirty for human review.
89
+
90
+ ---
91
+
92
+ ## ๐Ÿš€ Quick start
93
+
94
+ ### Install (pick one)
95
+
96
+ **Option A โ€” `pipx` (recommended, isolated)**
97
+ ```bash
98
+ pipx install git+https://github.com/Yash-Koladiya30/fixfleet.git
99
+ fixfleet
100
+ ```
101
+
102
+ **Option B โ€” `uv tool`**
103
+ ```bash
104
+ uv tool install git+https://github.com/Yash-Koladiya30/fixfleet.git
105
+ fixfleet
106
+ ```
107
+
108
+ **Option C โ€” one-shot run via `uvx` (no install)**
109
+ ```bash
110
+ uvx --from git+https://github.com/Yash-Koladiya30/fixfleet.git fixfleet
111
+ ```
112
+
113
+ **Option D โ€” plain `pip`**
114
+ ```bash
115
+ pip install git+https://github.com/Yash-Koladiya30/fixfleet.git
116
+ fixfleet
117
+ ```
118
+
119
+ **Option E โ€” clone + run (for hacking on the code)**
120
+ ```bash
121
+ git clone https://github.com/Yash-Koladiya30/fixfleet.git
122
+ cd fixfleet
123
+ python3 fix_bugs.py
124
+ ```
125
+
126
+ Pure stdlib โ€” **no runtime dependencies**. Works on Python 3.9+.
127
+
128
+ ### Upgrade
129
+
130
+ ```bash
131
+ pipx upgrade fixfleet # if installed with pipx
132
+ uv tool upgrade fixfleet # if installed with uv
133
+ ```
134
+
135
+ ### Uninstall
136
+
137
+ ```bash
138
+ pipx uninstall fixfleet
139
+ ```
140
+
141
+ ---
142
+
143
+ ## ๐Ÿ”Œ Backend options
144
+
145
+ You need **at least one** of these. Mix and match per session.
146
+
147
+ ### CLI backends (use existing paid plans)
148
+
149
+ | CLI | Install | Login | Plan source |
150
+ |---|---|---|---|
151
+ | **Claude Code** | `npm i -g @anthropic-ai/claude-code` | `claude login` | Claude Pro/Max |
152
+ | **Codex** | `npm i -g @openai/codex` | `codex login` | ChatGPT Plus/Pro |
153
+ | **Gemini CLI** | `npm i -g @google/gemini-cli` | `gemini auth` | Google account (free tier) |
154
+ | **Cursor Agent** | install from cursor.sh | `cursor-agent login` | Cursor Pro |
155
+ | **Aider** | `pip install aider-chat` | API key | Bring your own |
156
+ | **Qwen Code** | `npm i -g @qwen-code/qwen-code` | OAuth or key | Free tier |
157
+
158
+ ### API backends (free tier-friendly)
159
+
160
+ Single OpenAI-compatible client serves all of these:
161
+
162
+ | Provider | Free? | Get key |
163
+ |---|---|---|
164
+ | **Groq** | โœ… Free, fast (~500 tok/s) | https://console.groq.com/keys |
165
+ | **Google Gemini** | โœ… Free tier, big quota | https://aistudio.google.com/apikey |
166
+ | **OpenRouter** | โœ… Many free models | https://openrouter.ai/keys |
167
+ | **Cerebras** | โœ… Free tier | https://cloud.cerebras.ai |
168
+ | **Ollama** | โœ… Local, no key, offline | https://ollama.com |
169
+ | **LM Studio** | โœ… Local, no key | https://lmstudio.ai |
170
+
171
+ ---
172
+
173
+ ## ๐Ÿ”‘ Generating a GitLab token
174
+
175
+ 1. Go to **gitlab.com โ†’ top-right avatar โ†’ Edit profile โ†’ Access Tokens**.
176
+ 2. Create a Personal Access Token with scope: **`api`** or **`read_api`**.
177
+ 3. Copy the `glpat-...` token. GitLab shows it **once**.
178
+ 4. Paste when FixFleet asks. Typing is hidden via `getpass`.
179
+
180
+ > โš ๏ธ **Never commit tokens.** This repo's `.gitignore` already excludes `.env`, `*.token`, `secrets.*`, and the local config files (`~/.bugfixer.json`, `~/.bugfixer-state.json` are stored in your home dir, NOT in the repo).
181
+
182
+ ---
183
+
184
+ ## ๐Ÿงญ Flow
185
+
186
+ ```
187
+ Step 0 Choose Backend โ†’ pick installed CLI or configure API
188
+ Step 1 GitLab Token โ†’ paste glpat-...
189
+ Step 2 GitLab Project โ†’ paste full URL (or short path / numeric ID)
190
+ Step 3 Local Project Dir โ†’ path to cloned repo on your Mac
191
+ Step 4 Date Filter โ†’ YYYY-MM-DD or Enter for all
192
+ Step 5 Fetching Issues โ†’ auto-paginated
193
+ Step 6 Select Issues โ†’ 1,3,5 | all | unfixed | q
194
+ โ†’ fixes each, shows budget + confidence per issue
195
+ ```
196
+
197
+ After Step 0/2/3, defaults save to `~/.bugfixer.json` โ€” next run press Enter to reuse.
198
+
199
+ ### Inputs accepted at Step 2
200
+
201
+ | Input | Auto-extracts |
202
+ |---|---|
203
+ | `https://gitlab.com/group/project` | gitlab.com host + path |
204
+ | `https://gitlab.com/group/project.git` | strips `.git` |
205
+ | `https://gitlab.com/g/p/-/issues` | strips UI suffix |
206
+ | `git@gitlab.com:group/project.git` | SSH form |
207
+ | `https://gitlab.example.com/team/repo` | self-hosted host |
208
+ | `group/project` | short form |
209
+ | `12345` | numeric ID |
210
+
211
+ ---
212
+
213
+ ## ๐ŸŽฏ Confidence + Semantic Scoring
214
+
215
+ Every fix gets graded:
216
+
217
+ ```
218
+ Confidence Report
219
+ Final score: 0.84 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘ (High)
220
+ Self-rating: 8/10
221
+ Root cause: Missing null check in handleSubmit
222
+ Diff focus: 0.92
223
+ File relevance: 0.85
224
+ Hedge density: 1.2%
225
+ Tests run: no
226
+ Files changed: 1 (12 lines)
227
+ ```
228
+
229
+ Sources: model self-rating from the structured `FIX REPORT` block, `git diff` metrics, hedge-word density, file-relevance vs candidate list.
230
+
231
+ ---
232
+
233
+ ## ๐Ÿ’ฐ Token optimization
234
+
235
+ - **Locator** pre-greps the repo for candidate files โ†’ top file inlined directly into prompt
236
+ - **Section caps** trim long descriptions/logs before sending
237
+ - **Budget enforcement** โ€” per-issue, session, daily caps in config
238
+ - **State persistence** โ€” skips already-fixed issues, tracks daily usage per backend
239
+
240
+ Typical savings vs naive prompt: **60โ€“80% tokens** for bugs with file/trace hints.
241
+
242
+ ---
243
+
244
+ ## โš™๏ธ Configuration
245
+
246
+ Local config: `~/.bugfixer.json`
247
+
248
+ ```json
249
+ {
250
+ "default_backend": "claude",
251
+ "default_project_id": "group/project",
252
+ "default_project_host": "gitlab.com",
253
+ "default_project_dir": "/Users/you/work/project",
254
+ "api": {
255
+ "preset": "groq",
256
+ "base_url": "https://api.groq.com/openai/v1",
257
+ "api_key": "gsk_...",
258
+ "model": "llama-3.3-70b-versatile"
259
+ },
260
+ "budgets": {
261
+ "session_max_tokens": 200000,
262
+ "per_issue_max_tokens": 30000,
263
+ "daily_max_tokens": 500000
264
+ },
265
+ "skip_already_fixed": true
266
+ }
267
+ ```
268
+
269
+ > ๐Ÿ”’ Lives in your home directory, **NOT** the repo. The `.gitignore` excludes it from git regardless.
270
+
271
+ Override the backend per run with an env var:
272
+ ```bash
273
+ BUGFIXER_BACKEND=codex python3 fix_bugs.py
274
+ ```
275
+
276
+ ---
277
+
278
+ ## ๐Ÿงช Testing
279
+
280
+ ```bash
281
+ python3 -m unittest tests.test_all -v
282
+ ```
283
+
284
+ 54+ unit tests cover parser, locator, budget, confidence, prompt, registry, diff-apply, state, config, URL parsing, path sanitization.
285
+
286
+ ---
287
+
288
+ ## ๐Ÿ“‚ Project layout
289
+
290
+ ```
291
+ fixfleet/
292
+ โ”œโ”€โ”€ bugfixer/
293
+ โ”‚ โ”œโ”€โ”€ ui.py terminal styling
294
+ โ”‚ โ”œโ”€โ”€ gitlab.py API client + URL parser
295
+ โ”‚ โ”œโ”€โ”€ parser.py issue-body section extractor
296
+ โ”‚ โ”œโ”€โ”€ locator.py signal extraction + file ranking + inlining
297
+ โ”‚ โ”œโ”€โ”€ prompt.py structured prompt builder
298
+ โ”‚ โ”œโ”€โ”€ budget.py token slimming + estimation + caps
299
+ โ”‚ โ”œโ”€โ”€ confidence.py diff metrics + self-rating + hedge density
300
+ โ”‚ โ”œโ”€โ”€ state.py ~/.bugfixer-state.json
301
+ โ”‚ โ”œโ”€โ”€ config.py ~/.bugfixer.json
302
+ โ”‚ โ”œโ”€โ”€ cli.py interactive flow orchestration
303
+ โ”‚ โ””โ”€โ”€ backends/
304
+ โ”‚ โ”œโ”€โ”€ base.py Backend ABC
305
+ โ”‚ โ”œโ”€โ”€ _subprocess.py tee runner
306
+ โ”‚ โ”œโ”€โ”€ registry.py detect installed CLIs + API presets
307
+ โ”‚ โ”œโ”€โ”€ cli/ claude ยท codex ยท gemini ยท cursor ยท aider ยท qwen
308
+ โ”‚ โ””โ”€โ”€ api/openai_compat.py
309
+ โ”œโ”€โ”€ fix_bugs.py entry shim
310
+ โ””โ”€โ”€ tests/test_all.py
311
+ ```
312
+
313
+ ---
314
+
315
+ ## ๐Ÿ›ก๏ธ Security notes
316
+
317
+ - Tokens / API keys typed via `getpass` โ€” never echoed to terminal, never written to repo.
318
+ - All issue body content is **fenced** in the prompt with adaptive fence length to prevent prompt-injection from malicious issue authors.
319
+ - The `.gitignore` excludes config + state files, common secret files (`.env`, `*.token`, `*.key`).
320
+ - The tool **never** commits or pushes โ€” manual review required before sharing fixes.
321
+
322
+ ---
323
+
324
+ ## ๐Ÿž Troubleshooting
325
+
326
+ | Symptom | Fix |
327
+ |---|---|
328
+ | `claude command not found` | Install one CLI or pick the API option in Step 0 |
329
+ | `HTTP 401` from GitLab | Token expired or wrong scope (`read_api`/`api` needed) |
330
+ | `HTTP 404` | Wrong project URL/ID format |
331
+ | "No bugs found" | GitLab issues need exact `Bug` label (case-sensitive) |
332
+ | Path with spaces fails | Drag-drop folder from Finder works (auto-unescapes) |
333
+ | Want to reset config | `rm ~/.bugfixer.json ~/.bugfixer-state.json` |
334
+
335
+ ---
336
+
337
+ ## ๐Ÿค Contributing
338
+
339
+ Issues / PRs welcome. Guidelines:
340
+
341
+ - Pure stdlib โ€” no `requirements.txt` dependencies in core
342
+ - All new code paths need unit tests
343
+ - Run `python3 -m unittest tests.test_all` before submitting
344
+
345
+ ---
346
+
347
+ ## ๐Ÿ“„ License
348
+
349
+ MIT โ€” see [LICENSE](LICENSE). Built by **Yash Koladiya**.
@@ -0,0 +1,299 @@
1
+ <div align="center">
2
+
3
+ # ๐Ÿš€ FixFleet
4
+
5
+ ### **Auto-fix GitLab bugs with AI agents โ€” bring your own CLI or free API.**
6
+
7
+ *Reads open `Bug` issues from GitLab โ†’ parses stack traces and steps โ†’ pre-narrows the search to relevant files โ†’ dispatches to your AI agent of choice โ†’ scores the fix's confidence. All locally. No commits. No lock-in.*
8
+
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
11
+ [![Tests](https://img.shields.io/badge/tests-54%20passing-brightgreen.svg)](#-testing)
12
+ [![Stdlib only](https://img.shields.io/badge/dependencies-stdlib%20only-success.svg)](#-quick-start)
13
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](#-contributing)
14
+
15
+ **One command. Any AI. Zero waste.**
16
+
17
+ `Claude Code` ยท `Codex` ยท `Gemini CLI` ยท `Cursor Agent` ยท `Aider` ยท `Qwen Code` ยท `Groq` ยท `Gemini API` ยท `OpenRouter` ยท `Cerebras` ยท `Ollama` ยท `LM Studio`
18
+
19
+ </div>
20
+
21
+ ---
22
+
23
+ > ๐ŸŽฏ **What this tool does in one sentence:**
24
+ > *Pulls open bug tickets from GitLab, hands each one to an AI coding agent with the right context already pre-loaded, and scores how confident the fix is โ€” so you only review the ones worth reviewing.*
25
+
26
+ Built by **Yash Koladiya**.
27
+
28
+ ---
29
+
30
+ ## โœจ What it does
31
+
32
+ 1. Fetches **open issues with the `Bug` label** from any GitLab project (gitlab.com or self-hosted).
33
+ 2. Parses each issue body โ€” pulling out **Description, Steps to Reproduce, Expected/Actual behavior, Logs, Stack Traces** automatically.
34
+ 3. Pre-narrows the search space: extracts file paths, stack frames, symbols โ†’ **ranks candidate files in your local repo** so the AI doesn't waste tokens hunting.
35
+ 4. Dispatches the structured prompt to your chosen AI agent (CLI or API).
36
+ 5. Computes a **confidence score** for the fix using diff metrics + model self-rating + hedge-density.
37
+ 6. Tracks **token usage per backend per day** so you don't blow through paid quotas.
38
+ 7. **Never commits or pushes** โ€” leaves the working tree dirty for human review.
39
+
40
+ ---
41
+
42
+ ## ๐Ÿš€ Quick start
43
+
44
+ ### Install (pick one)
45
+
46
+ **Option A โ€” `pipx` (recommended, isolated)**
47
+ ```bash
48
+ pipx install git+https://github.com/Yash-Koladiya30/fixfleet.git
49
+ fixfleet
50
+ ```
51
+
52
+ **Option B โ€” `uv tool`**
53
+ ```bash
54
+ uv tool install git+https://github.com/Yash-Koladiya30/fixfleet.git
55
+ fixfleet
56
+ ```
57
+
58
+ **Option C โ€” one-shot run via `uvx` (no install)**
59
+ ```bash
60
+ uvx --from git+https://github.com/Yash-Koladiya30/fixfleet.git fixfleet
61
+ ```
62
+
63
+ **Option D โ€” plain `pip`**
64
+ ```bash
65
+ pip install git+https://github.com/Yash-Koladiya30/fixfleet.git
66
+ fixfleet
67
+ ```
68
+
69
+ **Option E โ€” clone + run (for hacking on the code)**
70
+ ```bash
71
+ git clone https://github.com/Yash-Koladiya30/fixfleet.git
72
+ cd fixfleet
73
+ python3 fix_bugs.py
74
+ ```
75
+
76
+ Pure stdlib โ€” **no runtime dependencies**. Works on Python 3.9+.
77
+
78
+ ### Upgrade
79
+
80
+ ```bash
81
+ pipx upgrade fixfleet # if installed with pipx
82
+ uv tool upgrade fixfleet # if installed with uv
83
+ ```
84
+
85
+ ### Uninstall
86
+
87
+ ```bash
88
+ pipx uninstall fixfleet
89
+ ```
90
+
91
+ ---
92
+
93
+ ## ๐Ÿ”Œ Backend options
94
+
95
+ You need **at least one** of these. Mix and match per session.
96
+
97
+ ### CLI backends (use existing paid plans)
98
+
99
+ | CLI | Install | Login | Plan source |
100
+ |---|---|---|---|
101
+ | **Claude Code** | `npm i -g @anthropic-ai/claude-code` | `claude login` | Claude Pro/Max |
102
+ | **Codex** | `npm i -g @openai/codex` | `codex login` | ChatGPT Plus/Pro |
103
+ | **Gemini CLI** | `npm i -g @google/gemini-cli` | `gemini auth` | Google account (free tier) |
104
+ | **Cursor Agent** | install from cursor.sh | `cursor-agent login` | Cursor Pro |
105
+ | **Aider** | `pip install aider-chat` | API key | Bring your own |
106
+ | **Qwen Code** | `npm i -g @qwen-code/qwen-code` | OAuth or key | Free tier |
107
+
108
+ ### API backends (free tier-friendly)
109
+
110
+ Single OpenAI-compatible client serves all of these:
111
+
112
+ | Provider | Free? | Get key |
113
+ |---|---|---|
114
+ | **Groq** | โœ… Free, fast (~500 tok/s) | https://console.groq.com/keys |
115
+ | **Google Gemini** | โœ… Free tier, big quota | https://aistudio.google.com/apikey |
116
+ | **OpenRouter** | โœ… Many free models | https://openrouter.ai/keys |
117
+ | **Cerebras** | โœ… Free tier | https://cloud.cerebras.ai |
118
+ | **Ollama** | โœ… Local, no key, offline | https://ollama.com |
119
+ | **LM Studio** | โœ… Local, no key | https://lmstudio.ai |
120
+
121
+ ---
122
+
123
+ ## ๐Ÿ”‘ Generating a GitLab token
124
+
125
+ 1. Go to **gitlab.com โ†’ top-right avatar โ†’ Edit profile โ†’ Access Tokens**.
126
+ 2. Create a Personal Access Token with scope: **`api`** or **`read_api`**.
127
+ 3. Copy the `glpat-...` token. GitLab shows it **once**.
128
+ 4. Paste when FixFleet asks. Typing is hidden via `getpass`.
129
+
130
+ > โš ๏ธ **Never commit tokens.** This repo's `.gitignore` already excludes `.env`, `*.token`, `secrets.*`, and the local config files (`~/.bugfixer.json`, `~/.bugfixer-state.json` are stored in your home dir, NOT in the repo).
131
+
132
+ ---
133
+
134
+ ## ๐Ÿงญ Flow
135
+
136
+ ```
137
+ Step 0 Choose Backend โ†’ pick installed CLI or configure API
138
+ Step 1 GitLab Token โ†’ paste glpat-...
139
+ Step 2 GitLab Project โ†’ paste full URL (or short path / numeric ID)
140
+ Step 3 Local Project Dir โ†’ path to cloned repo on your Mac
141
+ Step 4 Date Filter โ†’ YYYY-MM-DD or Enter for all
142
+ Step 5 Fetching Issues โ†’ auto-paginated
143
+ Step 6 Select Issues โ†’ 1,3,5 | all | unfixed | q
144
+ โ†’ fixes each, shows budget + confidence per issue
145
+ ```
146
+
147
+ After Step 0/2/3, defaults save to `~/.bugfixer.json` โ€” next run press Enter to reuse.
148
+
149
+ ### Inputs accepted at Step 2
150
+
151
+ | Input | Auto-extracts |
152
+ |---|---|
153
+ | `https://gitlab.com/group/project` | gitlab.com host + path |
154
+ | `https://gitlab.com/group/project.git` | strips `.git` |
155
+ | `https://gitlab.com/g/p/-/issues` | strips UI suffix |
156
+ | `git@gitlab.com:group/project.git` | SSH form |
157
+ | `https://gitlab.example.com/team/repo` | self-hosted host |
158
+ | `group/project` | short form |
159
+ | `12345` | numeric ID |
160
+
161
+ ---
162
+
163
+ ## ๐ŸŽฏ Confidence + Semantic Scoring
164
+
165
+ Every fix gets graded:
166
+
167
+ ```
168
+ Confidence Report
169
+ Final score: 0.84 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘ (High)
170
+ Self-rating: 8/10
171
+ Root cause: Missing null check in handleSubmit
172
+ Diff focus: 0.92
173
+ File relevance: 0.85
174
+ Hedge density: 1.2%
175
+ Tests run: no
176
+ Files changed: 1 (12 lines)
177
+ ```
178
+
179
+ Sources: model self-rating from the structured `FIX REPORT` block, `git diff` metrics, hedge-word density, file-relevance vs candidate list.
180
+
181
+ ---
182
+
183
+ ## ๐Ÿ’ฐ Token optimization
184
+
185
+ - **Locator** pre-greps the repo for candidate files โ†’ top file inlined directly into prompt
186
+ - **Section caps** trim long descriptions/logs before sending
187
+ - **Budget enforcement** โ€” per-issue, session, daily caps in config
188
+ - **State persistence** โ€” skips already-fixed issues, tracks daily usage per backend
189
+
190
+ Typical savings vs naive prompt: **60โ€“80% tokens** for bugs with file/trace hints.
191
+
192
+ ---
193
+
194
+ ## โš™๏ธ Configuration
195
+
196
+ Local config: `~/.bugfixer.json`
197
+
198
+ ```json
199
+ {
200
+ "default_backend": "claude",
201
+ "default_project_id": "group/project",
202
+ "default_project_host": "gitlab.com",
203
+ "default_project_dir": "/Users/you/work/project",
204
+ "api": {
205
+ "preset": "groq",
206
+ "base_url": "https://api.groq.com/openai/v1",
207
+ "api_key": "gsk_...",
208
+ "model": "llama-3.3-70b-versatile"
209
+ },
210
+ "budgets": {
211
+ "session_max_tokens": 200000,
212
+ "per_issue_max_tokens": 30000,
213
+ "daily_max_tokens": 500000
214
+ },
215
+ "skip_already_fixed": true
216
+ }
217
+ ```
218
+
219
+ > ๐Ÿ”’ Lives in your home directory, **NOT** the repo. The `.gitignore` excludes it from git regardless.
220
+
221
+ Override the backend per run with an env var:
222
+ ```bash
223
+ BUGFIXER_BACKEND=codex python3 fix_bugs.py
224
+ ```
225
+
226
+ ---
227
+
228
+ ## ๐Ÿงช Testing
229
+
230
+ ```bash
231
+ python3 -m unittest tests.test_all -v
232
+ ```
233
+
234
+ 54+ unit tests cover parser, locator, budget, confidence, prompt, registry, diff-apply, state, config, URL parsing, path sanitization.
235
+
236
+ ---
237
+
238
+ ## ๐Ÿ“‚ Project layout
239
+
240
+ ```
241
+ fixfleet/
242
+ โ”œโ”€โ”€ bugfixer/
243
+ โ”‚ โ”œโ”€โ”€ ui.py terminal styling
244
+ โ”‚ โ”œโ”€โ”€ gitlab.py API client + URL parser
245
+ โ”‚ โ”œโ”€โ”€ parser.py issue-body section extractor
246
+ โ”‚ โ”œโ”€โ”€ locator.py signal extraction + file ranking + inlining
247
+ โ”‚ โ”œโ”€โ”€ prompt.py structured prompt builder
248
+ โ”‚ โ”œโ”€โ”€ budget.py token slimming + estimation + caps
249
+ โ”‚ โ”œโ”€โ”€ confidence.py diff metrics + self-rating + hedge density
250
+ โ”‚ โ”œโ”€โ”€ state.py ~/.bugfixer-state.json
251
+ โ”‚ โ”œโ”€โ”€ config.py ~/.bugfixer.json
252
+ โ”‚ โ”œโ”€โ”€ cli.py interactive flow orchestration
253
+ โ”‚ โ””โ”€โ”€ backends/
254
+ โ”‚ โ”œโ”€โ”€ base.py Backend ABC
255
+ โ”‚ โ”œโ”€โ”€ _subprocess.py tee runner
256
+ โ”‚ โ”œโ”€โ”€ registry.py detect installed CLIs + API presets
257
+ โ”‚ โ”œโ”€โ”€ cli/ claude ยท codex ยท gemini ยท cursor ยท aider ยท qwen
258
+ โ”‚ โ””โ”€โ”€ api/openai_compat.py
259
+ โ”œโ”€โ”€ fix_bugs.py entry shim
260
+ โ””โ”€โ”€ tests/test_all.py
261
+ ```
262
+
263
+ ---
264
+
265
+ ## ๐Ÿ›ก๏ธ Security notes
266
+
267
+ - Tokens / API keys typed via `getpass` โ€” never echoed to terminal, never written to repo.
268
+ - All issue body content is **fenced** in the prompt with adaptive fence length to prevent prompt-injection from malicious issue authors.
269
+ - The `.gitignore` excludes config + state files, common secret files (`.env`, `*.token`, `*.key`).
270
+ - The tool **never** commits or pushes โ€” manual review required before sharing fixes.
271
+
272
+ ---
273
+
274
+ ## ๐Ÿž Troubleshooting
275
+
276
+ | Symptom | Fix |
277
+ |---|---|
278
+ | `claude command not found` | Install one CLI or pick the API option in Step 0 |
279
+ | `HTTP 401` from GitLab | Token expired or wrong scope (`read_api`/`api` needed) |
280
+ | `HTTP 404` | Wrong project URL/ID format |
281
+ | "No bugs found" | GitLab issues need exact `Bug` label (case-sensitive) |
282
+ | Path with spaces fails | Drag-drop folder from Finder works (auto-unescapes) |
283
+ | Want to reset config | `rm ~/.bugfixer.json ~/.bugfixer-state.json` |
284
+
285
+ ---
286
+
287
+ ## ๐Ÿค Contributing
288
+
289
+ Issues / PRs welcome. Guidelines:
290
+
291
+ - Pure stdlib โ€” no `requirements.txt` dependencies in core
292
+ - All new code paths need unit tests
293
+ - Run `python3 -m unittest tests.test_all` before submitting
294
+
295
+ ---
296
+
297
+ ## ๐Ÿ“„ License
298
+
299
+ MIT โ€” see [LICENSE](LICENSE). Built by **Yash Koladiya**.
@@ -0,0 +1,6 @@
1
+ """FixFleet โ€” Fleet of AI agents fixing GitLab bugs."""
2
+
3
+ __version__ = "0.3.0"
4
+ __name_pretty__ = "FixFleet"
5
+ __tagline__ = "Fleet of AI agents fixing GitLab bugs"
6
+ __author__ = "Yash Koladiya"
@@ -0,0 +1 @@
1
+ """Pluggable backends โ€” CLI tools and API clients that fix bugs."""