bugzero 0.0.3 → 0.0.5

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > bugzero@0.0.1 build D:\WD projects\OpsPilot\packages\cli
2
+ > bugzero@0.0.4 build D:\WD projects\OpsPilot\packages\cli
3
3
  > tsup src/index.ts --format esm --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -7,8 +7,10 @@
7
7
  CLI tsup v8.5.1
8
8
  CLI Target: es2022
9
9
  ESM Build start
10
- ESM dist\index.js 41.55 KB
11
- ESM ⚡️ Build success in 165ms
10
+ ESM dist\index.js 31.38 KB
11
+ ESM dist\chunk-4ANZDGVD.js 16.11 KB
12
+ ESM dist\dist-FQYNA36C.js 85.00 B
13
+ ESM ⚡️ Build success in 133ms
12
14
  DTS Build start
13
- DTS ⚡️ Build success in 1740ms
15
+ DTS ⚡️ Build success in 1828ms
14
16
  DTS dist\index.d.ts 20.00 B
package/README.md CHANGED
@@ -1,143 +1,258 @@
1
- # 🚀 BugZero
1
+ # BugZero
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/bugzero.svg?style=flat-square&color=FF69B4)](https://www.npmjs.com/package/bugzero)
3
+ [![npm version](https://img.shields.io/npm/v/bugzero.svg?style=flat-square)](https://www.npmjs.com/package/bugzero)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)
5
+ [![Node.js](https://img.shields.io/badge/Node.js-18%2B-green?style=flat-square)](https://nodejs.org)
5
6
  [![pnpm](https://img.shields.io/badge/maintained%20with-pnpm-cc00ff.svg?style=flat-square)](https://pnpm.io/)
6
7
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/Saksham1800t)
7
8
 
8
- **BugZero** is an autonomous, AI-powered self-healing command-line tool. It monitors build, lint, and test errors in your project, analyzes them using an LLM, generates precise surgical code patches, applies them safely, and runs validation loops recursively until your build is completely green.
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
- Designed for modern developer loops, CI/CD pipelines, and automated hotfixes.
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
- ## 🛠️ How it Works
15
-
16
- ```mermaid
17
- graph TD
18
- A[Start: bugzero rescue] --> B[Run build, lint, and test scripts]
19
- B --> C{Any Failures?}
20
- C -- No --> D[Success: Exits cleanly]
21
- C -- Yes --> E[Capture error outputs and logs]
22
- E --> F[Prompt LLM via LangGraph Agent]
23
- F --> G[Parse Structured Fix Suggestion]
24
- G --> H[Apply Precise Search & Replace Patch]
25
- H --> I[Verify build and validation tests]
26
- I --> J{Build Fixed?}
27
- J -- Yes --> K[✅ Output Fix Details & Exit]
28
- J -- No --> L{Max attempts reached?}
29
- L -- Yes --> M[❌ Exit failure with logs]
30
- L -- No --> F
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
27
+
28
+ ```
29
+ bugzero rescue
30
+ |
31
+ v
32
+ Run Build + Lint + Tests
33
+ |
34
+ v
35
+ Any failures? ---- No ---> Build already passing. Exit cleanly.
36
+ |
37
+ Yes
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
+ |
57
+ No
58
+ |
59
+ v
60
+ Max attempts reached? -- Yes ---> Exit with failure logs.
61
+ |
62
+ No
63
+ |
64
+ +-------------------> Prompt LLM again (next attempt)
31
65
  ```
32
66
 
33
67
  ---
34
68
 
35
- ## 🌟 Key Features
69
+ ## Key Features
36
70
 
37
- * **🔍 Automatic Framework Detection**: Detects common web frameworks and tooling setups inside your target directories.
38
- * **🤖 LangGraph-Based Feedback Loop**: Employs stateful graphs to analyze compiler/test outputs, write minimal patches, and re-run compilation checks recursively.
39
- * **⚡ Surgical Search-and-Replace**: Avoids corrupting files by using highly specific search-and-replace strings generated directly from the abstract syntax context.
40
- * **📦 Safe Backups**: Creates a backup `.bugzero.bak` for every modified file so you can revert modifications easily.
41
- * **📈 Multiple Checkups**: Validates builds, style guidelines (ESLint), and testing frameworks (Jest) automatically.
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 |
42
80
 
43
81
  ---
44
82
 
45
- ## 🚀 Getting Started
83
+ ## Installation
84
+
85
+ Install globally from the NPM registry:
46
86
 
47
- ### 1. Global Installation
48
- Install `bugzero` globally from NPM:
49
87
  ```bash
50
88
  npm install -g bugzero
51
89
  ```
52
90
 
53
- ### 2. Configure Environment Variables
54
- BugZero relies on OpenRouter to access Claude. Configure your environment variable in your terminal session or add it to a `.env` file at the root of the project you are fixing:
91
+ ---
92
+
93
+ ## Setup
94
+
95
+ BugZero requires an [OpenRouter](https://openrouter.ai) API key to call AI models. Set it as an environment variable before running any command.
55
96
 
56
- **On macOS/Linux:**
97
+ **Linux / macOS:**
57
98
  ```bash
58
99
  export OPENROUTER_API_KEY="your_openrouter_api_key_here"
59
100
  ```
60
101
 
61
- **On Windows (PowerShell):**
102
+ **Windows (PowerShell):**
62
103
  ```powershell
63
104
  $env:OPENROUTER_API_KEY="your_openrouter_api_key_here"
64
105
  ```
65
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
+
66
112
  ---
67
113
 
68
- ## 💻 Usage & Commands
114
+ ## Commands
69
115
 
70
- Run `bugzero` from any terminal directory.
116
+ ### `bugzero hunt`
117
+ Run build, lint, and test checks. Reports all failures without modifying any files.
71
118
 
72
- ### 1. Hunt for Bugs (Dry-Run / Safe Check)
73
- Run build, lint, and test checks to report error diagnostics without modifying any files.
74
119
  ```bash
75
120
  bugzero hunt --path /path/to/your/project
76
121
  ```
77
122
 
78
- ### 2. Rescue Your Project (Autonomous Mode)
79
- Run the AI repair loop to automatically detect compilation errors, generate code patches, apply them, and verify the build.
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
+
80
126
  ```bash
81
127
  bugzero rescue --path /path/to/your/project
82
128
  ```
83
129
 
84
- ### 3. Vibe With a Brain (Change AI Model)
85
- List and select which LLM model you want to use. This fetches the latest available models from OpenRouter, lets you pick one, and saves it inside `.bugzerorc`.
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
+
86
141
  ```bash
87
142
  bugzero vibe
88
143
  ```
89
144
 
90
- ### CLI Command Options
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:
91
157
 
92
- | Option | Shorthand | Description | Default |
93
- | :--- | :--- | :--- | :--- |
94
- | `--path <dir>` | `-p <dir>` | The path to the target project you want to check/fix | `.` (Current directory) |
95
- | `--max-attempts <num>` | `-n <num>` | Maximum AI fix loops/attempts before giving up | `3` |
96
- | `--dry-run` | | Print the recommended fixes without saving changes to files | `false` |
158
+ ```json
159
+ {
160
+ "model": "deepseek/deepseek-chat"
161
+ }
162
+ ```
163
+
164
+ This file is created automatically when you run `bugzero vibe`.
97
165
 
98
166
  ---
99
167
 
100
- ## 🧱 Monorepo Development & Local Setup
168
+ ## Development Setup
101
169
 
102
- If you want to contribute to the BugZero engine:
170
+ Clone the repository and install dependencies. This project uses a pnpm monorepo managed by Turborepo.
103
171
 
104
172
  ### Prerequisites
105
- * Node.js (LTS version recommended)
106
- * `pnpm` (workspace manager)
173
+ - Node.js 18 or later
174
+ - pnpm
175
+
176
+ ### Install
107
177
 
108
- ### Installation
109
- Clone the repository, go into the workspace root, and run:
110
178
  ```bash
111
179
  pnpm install
112
180
  ```
113
181
 
114
- ### Local Commands
115
- * **Build all monorepo packages**:
116
- ```bash
117
- pnpm build
118
- ```
119
- * **Run CLI locally in development mode (shortcuts)**:
120
- ```bash
121
- pnpm hunt --path ./demo-project
122
- pnpm rescue --path ./demo-project
123
- pnpm vibe
124
- ```
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 |
125
209
 
126
210
  ---
127
211
 
128
- ## 👥 Author
212
+ ## Error Handling
129
213
 
130
- Made with ❤️ and 😎 by:
214
+ BugZero provides clear, actionable output for common failure modes:
131
215
 
132
- * **Name**: Saksham Agarwal
133
- * **Email**: [sakshamagarwal0507@gmail.com](mailto:sakshamagarwal0507@gmail.com)
134
- * **GitHub**: [@Saksham1800t](https://github.com/Saksham1800t)
135
- * **LinkedIn**: [Saksham Agarwal](https://www.linkedin.com/in/saksham-agarwal-/)
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 |
136
223
 
137
224
  ---
138
225
 
139
- ## ☕ Support My Work
226
+ ## Contributing
227
+
228
+ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
229
+
230
+ 1. Fork the repository
231
+ 2. Create your feature branch (`git checkout -b feature/my-feature`)
232
+ 3. Commit your changes (`git commit -m 'Add my feature'`)
233
+ 4. Push to the branch (`git push origin feature/my-feature`)
234
+ 5. Open a Pull Request
235
+
236
+ ---
237
+
238
+ ## Author
239
+
240
+ **Saksham Agarwal**
241
+
242
+ - GitHub: [@Saksham1800t](https://github.com/Saksham1800t)
243
+ - LinkedIn: [Saksham Agarwal](https://www.linkedin.com/in/saksham-agarwal-/)
244
+ - Email: [sakshamagarwal0507@gmail.com](mailto:sakshamagarwal0507@gmail.com)
245
+
246
+ ---
247
+
248
+ ## Support
249
+
250
+ If BugZero saved you debugging hours in production or deployment pipelines, consider buying the author a coffee.
251
+
252
+ [![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/saksham_)
253
+
254
+ ---
140
255
 
141
- If BugZero saved you debugging hours in production or deployment pipelines, support the project!
256
+ ## License
142
257
 
143
- [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/saksham_)
258
+ MIT — see [LICENSE](LICENSE) for details.