bugzero 0.0.4 → 0.0.6
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.
- package/README.md +170 -89
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,165 +1,246 @@
|
|
|
1
|
-
#
|
|
1
|
+
# BugZero
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/bugzero)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://nodejs.org)
|
|
5
6
|
[](https://pnpm.io/)
|
|
6
7
|
[](https://github.com/Saksham1800t)
|
|
7
8
|
|
|
8
|
-
**BugZero** is an autonomous, AI-powered
|
|
9
|
+
**BugZero** is an autonomous, AI-powered CLI tool for automatic build error detection and repair. It runs your build pipeline, parses compiler and linter output, invokes an LLM to generate a surgical code fix, applies it safely with a backup, and re-runs validation — looping until your project builds successfully or the attempt limit is reached.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
Built for developers who want zero-downtime repair cycles, automated CI/CD recovery, and production-grade error resolution without manual debugging.
|
|
11
12
|
|
|
12
13
|
---
|
|
13
14
|
|
|
14
|
-
##
|
|
15
|
+
## Why BugZero?
|
|
16
|
+
|
|
17
|
+
Modern applications fail at build and deployment time for reasons that are repetitive, predictable, and ultimately fixable by a knowledgeable agent. BugZero bridges the gap between raw compiler output and working code — automatically.
|
|
18
|
+
|
|
19
|
+
- **No more debugging the same TypeScript error twice.** The agent reads the stack trace, finds the file, generates the fix, and verifies it.
|
|
20
|
+
- **Safe by design.** Every file modified gets a `.opspilot.bak` backup before any change is applied.
|
|
21
|
+
- **Model agnostic.** Works with DeepSeek, Claude, Gemini, GPT-4o, Llama, or any model available on OpenRouter.
|
|
22
|
+
- **Feedback loop included.** The LangGraph state machine retries intelligently until the build passes or the max attempts threshold is hit.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## How it Works
|
|
15
27
|
|
|
16
28
|
```
|
|
17
29
|
bugzero rescue
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
|
|
|
31
|
+
v
|
|
20
32
|
Run Build + Lint + Tests
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Any failures?
|
|
24
|
-
|
|
33
|
+
|
|
|
34
|
+
v
|
|
35
|
+
Any failures? ---- No ---> Build already passing. Exit cleanly.
|
|
36
|
+
|
|
|
25
37
|
Yes
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Capture error logs
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Prompt LLM via LangGraph
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Parse fix suggestion (JSON)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Apply search-and-replace patch
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Re-run build to verify
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Build fixed?
|
|
44
|
-
|
|
38
|
+
|
|
|
39
|
+
v
|
|
40
|
+
Capture and parse error logs
|
|
41
|
+
|
|
|
42
|
+
v
|
|
43
|
+
Prompt selected LLM via LangGraph Agent
|
|
44
|
+
|
|
|
45
|
+
v
|
|
46
|
+
Parse structured fix suggestion (JSON)
|
|
47
|
+
|
|
|
48
|
+
v
|
|
49
|
+
Apply search-and-replace patch (with .bak backup)
|
|
50
|
+
|
|
|
51
|
+
v
|
|
52
|
+
Re-run build to verify the fix
|
|
53
|
+
|
|
|
54
|
+
v
|
|
55
|
+
Build fixed? --- Yes ---> Print fix details. Exit success.
|
|
56
|
+
|
|
|
45
57
|
No
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
Max attempts reached?
|
|
49
|
-
|
|
58
|
+
|
|
|
59
|
+
v
|
|
60
|
+
Max attempts reached? -- Yes ---> Exit with failure logs.
|
|
61
|
+
|
|
|
50
62
|
No
|
|
51
|
-
|
|
52
|
-
|
|
63
|
+
|
|
|
64
|
+
+-------------------> Prompt LLM again (next attempt)
|
|
53
65
|
```
|
|
54
66
|
|
|
55
67
|
---
|
|
56
68
|
|
|
57
|
-
##
|
|
69
|
+
## Key Features
|
|
58
70
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
71
|
+
| Feature | Description |
|
|
72
|
+
|---|---|
|
|
73
|
+
| Autonomous repair loop | Runs analyze, patch, verify in a stateful LangGraph graph |
|
|
74
|
+
| Multi-model support | DeepSeek, Claude, GPT-4o, Gemini, Llama via OpenRouter |
|
|
75
|
+
| Framework detection | Automatically identifies your project's tooling setup |
|
|
76
|
+
| Safe file patching | Every modified file receives a `.opspilot.bak` backup |
|
|
77
|
+
| Error type parsing | Parses TypeScript, ESLint, and Jest error formats |
|
|
78
|
+
| Dry-run mode | Analyze and report without writing any files |
|
|
79
|
+
| Local model config | Save preferred model to `.bugzerorc` per project |
|
|
64
80
|
|
|
65
81
|
---
|
|
66
82
|
|
|
67
|
-
##
|
|
83
|
+
## Installation
|
|
84
|
+
|
|
85
|
+
Install globally from the NPM registry:
|
|
68
86
|
|
|
69
|
-
### 1. Global Installation
|
|
70
|
-
Install `bugzero` globally from NPM:
|
|
71
87
|
```bash
|
|
72
88
|
npm install -g bugzero
|
|
73
89
|
```
|
|
74
90
|
|
|
75
|
-
|
|
76
|
-
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Setup
|
|
77
94
|
|
|
78
|
-
|
|
95
|
+
BugZero requires an [OpenRouter](https://openrouter.ai) API key to call AI models. Set it as an environment variable before running any command.
|
|
96
|
+
|
|
97
|
+
**Linux / macOS:**
|
|
79
98
|
```bash
|
|
80
99
|
export OPENROUTER_API_KEY="your_openrouter_api_key_here"
|
|
81
100
|
```
|
|
82
101
|
|
|
83
|
-
**
|
|
102
|
+
**Windows (PowerShell):**
|
|
84
103
|
```powershell
|
|
85
104
|
$env:OPENROUTER_API_KEY="your_openrouter_api_key_here"
|
|
86
105
|
```
|
|
87
106
|
|
|
107
|
+
**Or** create a `.env` file in the project root you are targeting:
|
|
108
|
+
```env
|
|
109
|
+
OPENROUTER_API_KEY=your_openrouter_api_key_here
|
|
110
|
+
```
|
|
111
|
+
|
|
88
112
|
---
|
|
89
113
|
|
|
90
|
-
##
|
|
114
|
+
## Commands
|
|
91
115
|
|
|
92
|
-
|
|
116
|
+
### `bugzero hunt`
|
|
117
|
+
Run build, lint, and test checks. Reports all failures without modifying any files.
|
|
93
118
|
|
|
94
|
-
### 1. Hunt for Bugs (Dry-Run / Safe Check)
|
|
95
|
-
Run build, lint, and test checks to report error diagnostics without modifying any files.
|
|
96
119
|
```bash
|
|
97
120
|
bugzero hunt --path /path/to/your/project
|
|
98
121
|
```
|
|
99
122
|
|
|
100
|
-
###
|
|
101
|
-
Run the AI repair loop
|
|
123
|
+
### `bugzero rescue`
|
|
124
|
+
Run the full AI-powered repair loop. Detects build failures, generates precise code patches, applies them, and verifies the result.
|
|
125
|
+
|
|
102
126
|
```bash
|
|
103
127
|
bugzero rescue --path /path/to/your/project
|
|
104
128
|
```
|
|
105
129
|
|
|
106
|
-
|
|
107
|
-
|
|
130
|
+
Options:
|
|
131
|
+
|
|
132
|
+
| Flag | Short | Default | Description |
|
|
133
|
+
|---|---|---|---|
|
|
134
|
+
| `--path <dir>` | `-p` | `.` | Path to the target project |
|
|
135
|
+
| `--max-attempts <n>` | `-n` | `3` | Maximum AI fix iterations before giving up |
|
|
136
|
+
| `--dry-run` | | `false` | Analyze only — no files will be written |
|
|
137
|
+
|
|
138
|
+
### `bugzero vibe`
|
|
139
|
+
Interactively select which AI model to use. Fetches the current model list from OpenRouter, lets you pick one, and saves the selection to a local `.bugzerorc` config file.
|
|
140
|
+
|
|
108
141
|
```bash
|
|
109
142
|
bugzero vibe
|
|
110
143
|
```
|
|
111
144
|
|
|
112
|
-
|
|
145
|
+
Supported models (curated list, plus custom entry):
|
|
146
|
+
- DeepSeek V3 / DeepSeek R1
|
|
147
|
+
- Anthropic Claude 3.5 Sonnet
|
|
148
|
+
- Google Gemini 2.5 Pro / Flash
|
|
149
|
+
- OpenAI GPT-4o
|
|
150
|
+
- Meta Llama 3.3 Instruct
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Configuration
|
|
155
|
+
|
|
156
|
+
BugZero reads a `.bugzerorc` JSON file in your target project directory to pick up model preferences:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"model": "deepseek/deepseek-chat"
|
|
161
|
+
}
|
|
162
|
+
```
|
|
113
163
|
|
|
114
|
-
|
|
115
|
-
| :--- | :--- | :--- | :--- |
|
|
116
|
-
| `--path <dir>` | `-p <dir>` | The path to the target project you want to check/fix | `.` (Current directory) |
|
|
117
|
-
| `--max-attempts <num>` | `-n <num>` | Maximum AI fix loops/attempts before giving up | `3` |
|
|
118
|
-
| `--dry-run` | | Print the recommended fixes without saving changes to files | `false` |
|
|
164
|
+
This file is created automatically when you run `bugzero vibe`.
|
|
119
165
|
|
|
120
166
|
---
|
|
121
167
|
|
|
122
|
-
##
|
|
168
|
+
## Development Setup
|
|
123
169
|
|
|
124
|
-
|
|
170
|
+
Clone the repository and install dependencies. This project uses a pnpm monorepo managed by Turborepo.
|
|
125
171
|
|
|
126
172
|
### Prerequisites
|
|
127
|
-
|
|
128
|
-
|
|
173
|
+
- Node.js 18 or later
|
|
174
|
+
- pnpm
|
|
175
|
+
|
|
176
|
+
### Install
|
|
129
177
|
|
|
130
|
-
### Installation
|
|
131
|
-
Clone the repository, go into the workspace root, and run:
|
|
132
178
|
```bash
|
|
133
179
|
pnpm install
|
|
134
180
|
```
|
|
135
181
|
|
|
136
|
-
###
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
182
|
+
### Build all packages
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
pnpm build
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Run commands locally without installing globally
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
pnpm hunt --path ./demo-project
|
|
192
|
+
pnpm rescue --path ./demo-project
|
|
193
|
+
pnpm vibe
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Monorepo package structure
|
|
197
|
+
|
|
198
|
+
| Package | Role |
|
|
199
|
+
|---|---|
|
|
200
|
+
| `packages/cli` | CLI entrypoint (Commander) |
|
|
201
|
+
| `packages/core` | Orchestrates build and fix flow |
|
|
202
|
+
| `packages/agents` | LangGraph state machine (analyze, patch, verify) |
|
|
203
|
+
| `packages/ai-provider` | OpenRouter HTTP client |
|
|
204
|
+
| `packages/analyzers` | Runs build/lint/test and parses output |
|
|
205
|
+
| `packages/patcher` | Applies search-and-replace patches with backup |
|
|
206
|
+
| `packages/prompts` | LLM prompt templates |
|
|
207
|
+
| `packages/config` | Env loading and local `.bugzerorc` config store |
|
|
208
|
+
| `packages/shared` | Shared TypeScript types |
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Error Handling
|
|
213
|
+
|
|
214
|
+
BugZero provides clear, actionable output for common failure modes:
|
|
215
|
+
|
|
216
|
+
| Error | Message |
|
|
217
|
+
|---|---|
|
|
218
|
+
| Invalid API key (401) | Prompts you to check your `OPENROUTER_API_KEY` |
|
|
219
|
+
| Rate limit exceeded (429) | Prompts you to check your OpenRouter credit balance |
|
|
220
|
+
| Model not found | Displays the invalid model ID and suggests running `bugzero vibe` |
|
|
221
|
+
| Patch not applied | Reports exact mismatch between AI suggestion and file content |
|
|
222
|
+
| Max attempts reached | Exits cleanly with the last error log for manual review |
|
|
147
223
|
|
|
148
224
|
---
|
|
149
225
|
|
|
150
|
-
##
|
|
226
|
+
## Author
|
|
151
227
|
|
|
152
|
-
|
|
228
|
+
**Saksham Agarwal**
|
|
153
229
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
* **LinkedIn**: [Saksham Agarwal](https://www.linkedin.com/in/saksham-agarwal-/)
|
|
230
|
+
- GitHub: [@Saksham1800t](https://github.com/Saksham1800t)
|
|
231
|
+
- LinkedIn: [Saksham Agarwal](https://www.linkedin.com/in/saksham-agarwal-/)
|
|
232
|
+
- Email: [sakshamagarwal0507@gmail.com](mailto:sakshamagarwal0507@gmail.com)
|
|
158
233
|
|
|
159
234
|
---
|
|
160
235
|
|
|
161
|
-
##
|
|
236
|
+
## Support
|
|
237
|
+
|
|
238
|
+
If BugZero saved you debugging hours in production or deployment pipelines, consider buying the author a coffee.
|
|
239
|
+
|
|
240
|
+
[](https://www.buymeacoffee.com/saksham_)
|
|
241
|
+
|
|
242
|
+
---
|
|
162
243
|
|
|
163
|
-
|
|
244
|
+
## License
|
|
164
245
|
|
|
165
|
-
|
|
246
|
+
MIT — see [LICENSE](LICENSE) for details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugzero",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"bin": {
|
|
5
5
|
"bugzero": "dist/index.js"
|
|
6
6
|
},
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"execa": "^7.2.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
+
"@opspilot/agents": "0.0.1",
|
|
15
16
|
"@opspilot/config": "0.0.1",
|
|
16
|
-
"@opspilot/core": "0.0.1"
|
|
17
|
-
"@opspilot/agents": "0.0.1"
|
|
17
|
+
"@opspilot/core": "0.0.1"
|
|
18
18
|
},
|
|
19
19
|
"main": "./dist/index.js",
|
|
20
20
|
"types": "./dist/index.d.ts",
|