error-solution-ai-buddy 1.0.0 → 1.0.2

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 (2) hide show
  1. package/README.md +117 -234
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,292 +1,175 @@
1
- # Error → Solution AI Buddy 🤖
1
+ <div align="center">
2
2
 
3
- > AI-powered error explanations directly in your terminal. No context switching!
3
+ # errbuddy
4
4
 
5
- ![Node.js](https://img.shields.io/badge/Node.js-18+-green)
6
- ![Ollama](https://img.shields.io/badge/AI-Ollama-blue)
7
- ![License](https://img.shields.io/badge/License-MIT-yellow)
5
+ **Plain-English explanations for errors, right in your terminal.**
8
6
 
9
- ## The Problem
7
+ Stop copying stack traces into a browser. Prefix your command with `errbuddy` and get *what* went wrong, *why*, and *how to fix it* — from an AI model that runs on your own machine.
10
8
 
11
- You're coding. An error appears. You:
12
- 1. Copy the error
13
- 2. Open browser
14
- 3. Paste into Google/ChatGPT
15
- 4. Read through results
16
- 5. Go back to terminal
17
- 6. Forget what you were doing
9
+ [![npm version](https://img.shields.io/npm/v/error-solution-ai-buddy?color=cb3837&logo=npm)](https://www.npmjs.com/package/error-solution-ai-buddy)
10
+ [![npm downloads](https://img.shields.io/npm/dm/error-solution-ai-buddy)](https://www.npmjs.com/package/error-solution-ai-buddy)
11
+ ![Node](https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js&logoColor=white)
12
+ ![AI](https://img.shields.io/badge/AI-local%20via%20Ollama-black)
13
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sithija-jayasinghe/solution-ai-buddy-v1/blob/main/error-solution-ai-buddy/LICENSE)
18
14
 
19
- **That's 5+ context switches. We fix that.**
15
+ </div>
20
16
 
21
- ## The Solution
17
+ <p align="center">
18
+ <img src="https://raw.githubusercontent.com/sithija-jayasinghe/solution-ai-buddy-v1/main/error-solution-ai-buddy/docs/demo.gif" alt="errbuddy running node app.js: a TypeError appears, followed by an explanation of what went wrong, why, and how to fix it" width="760">
19
+ </p>
22
20
 
23
- ```bash
24
- $ errbuddy node app.js
25
-
26
- TypeError: Cannot read properties of undefined (reading 'map')
27
- at app.js:12:5
28
-
29
- ╭─ 🤖 Error Buddy Explanation: ─────────────────────────────────────╮
30
- │ │
31
- │ 📘 What is this? │
32
- │ You tried to use `.map()` on a variable that is undefined. │
33
- │ │
34
- │ ❓ Why it happens? │
35
- │ The data you expected (probably from an API) wasn't available. │
36
- │ │
37
- │ ✅ How to fix it: │
38
- │ Check if the variable exists before calling `.map()`. │
39
- │ │
40
- │ 💡 Example: │
41
- │ if (data) { │
42
- │ data.map(...) │
43
- │ } │
44
- │ │
45
- ╰────────────────────────────────────────────────────────────────────╯
46
- ```
21
+ ## Why errbuddy
22
+
23
+ When an error shows up, most of us copy it, open a browser, paste it into a search engine or chatbot, read, switch back, and lose our train of thought. errbuddy removes every one of those steps.
47
24
 
48
- ## Quick Start
25
+ - **Zero context switching.** The explanation appears right under the error.
26
+ - **Private by default.** The AI runs locally through [Ollama](https://ollama.com). Your code and errors never leave your computer.
27
+ - **Free.** No API keys, no accounts, no usage limits.
28
+ - **Works offline, and without AI.** If Ollama isn't running, errbuddy falls back to built-in explanations for common errors.
29
+ - **Drop-in.** Your program runs exactly as before: same output, same input, same exit code.
30
+
31
+ ## Quick start
49
32
 
50
33
  ```bash
51
34
  npm install -g error-solution-ai-buddy
52
35
  errbuddy node app.js
53
36
  ```
54
37
 
55
- That's it. Errors are explained with built-in pattern matching straight away.
56
-
57
- ### Turn on AI explanations (optional, free, runs on your machine)
38
+ That's it. You'll get pattern-based explanations straight away.
58
39
 
59
- errbuddy uses [Ollama](https://ollama.com) to run a small AI model locally, so your code and errors never leave your computer.
40
+ ### Turn on AI explanations (optional)
60
41
 
61
- 1. Install Ollama from https://ollama.com/download
62
- 2. Download the default model (about 400 MB):
42
+ 1. Install Ollama from [ollama.com/download](https://ollama.com/download)
43
+ 2. Download the default model (about 400 MB, runs fine on low-RAM laptops):
63
44
  ```bash
64
45
  ollama pull qwen2.5:0.5b
65
46
  ```
66
- 3. Make sure Ollama is running (`ollama serve`, or open the Ollama app)
67
-
68
- Want better explanations? Use a bigger model: `errbuddy --model llama3.2 node app.js`
69
-
70
- If Ollama isn't running, errbuddy still works — it falls back to pattern matching.
71
-
72
- ## Installation & Usage
73
-
74
- ### 1. Download the Project
75
- - Clone the repository:
76
- ```sh
77
- git clone <your-repo-url>
78
- ```
79
-
80
- ### 2. Install Dependencies
81
- - In the project folder, run:
82
- ```sh
83
- npm install
84
- ```
85
-
86
- ### 3. Use the CLI Tool
87
- - Go to the CLI directory:
88
- ```sh
89
- cd error-solution-ai-buddy/cli
90
- npm link
91
- ```
92
- - Now you can run the CLI from anywhere:
93
- ```sh
94
- errbuddy <your-command>
95
- # Example:
96
- errbuddy node test-error.js
97
- ```
98
-
99
- ### 4. Use the VS Code Extension
100
- - Build the extension (if needed):
101
- ```sh
102
- cd error-solution-ai-buddy/extension
103
- npm install
104
- npm run build
105
- ```
106
- - Install the extension in VS Code:
107
- - Use "Install from VSIX..." if you have a packaged file.
108
- - Or run:
109
- ```sh
110
- code --install-extension <path-to-extension-folder>
111
- ```
112
- - Reload VS Code.
113
-
114
- ### 5. Start Using
115
- - For CLI: Run commands with `errbuddy` prefix.
116
- - For extension: Use terminal and Error Buddy commands in VS Code.
117
- ### Manual Setup
118
-
119
- #### Step 1: Install Ollama (Optional - for AI features)
47
+ 3. Make sure Ollama is running: open the Ollama app, or run `ollama serve`
120
48
 
121
- ```bash
122
- # Windows: Download from https://ollama.ai
123
-
124
- # macOS
125
- brew install ollama
49
+ The next time you run `errbuddy`, it detects Ollama automatically. If the default model isn't installed but another one is, errbuddy uses that instead.
126
50
 
127
- # Linux
128
- curl -fsSL https://ollama.ai/install.sh | sh
129
- ```
51
+ ## Usage
130
52
 
131
- ### 2. Start Ollama & Download Model
53
+ Put `errbuddy` in front of the command you normally run:
132
54
 
133
55
  ```bash
134
- ollama serve # Start the server (keep this running)
135
- ollama pull llama3.2 # Download the model (~2GB)
56
+ errbuddy node app.js # instead of: node app.js
57
+ errbuddy npm start # instead of: npm start
58
+ errbuddy java MyApp # instead of: java MyApp
59
+ errbuddy dotnet run # instead of: dotnet run
136
60
  ```
137
- ### 3. Install Error Buddy
138
61
 
139
- ```bash
140
- # From this directory
141
- npm install
142
- npm link # Makes 'errbuddy' available globally
143
- ```
62
+ ### Options
144
63
 
145
- ### 4. Use It!
64
+ | Option | What it does |
65
+ |---|---|
66
+ | `--model <name>` | Use a different Ollama model, e.g. `--model llama3.2` for richer answers |
67
+ | `--offline` | Skip AI and use built-in pattern matching only |
68
+ | `--no-ai` | Show errors without any explanation |
69
+ | `-V, --version` | Show the installed version |
70
+ | `-h, --help` | Show help |
146
71
 
147
- ```bash
148
- # Instead of: node app.js
149
- errbuddy node app.js
72
+ | Command | What it does |
73
+ |---|---|
74
+ | `errbuddy examples` | Show usage examples |
75
+ | `errbuddy config` | Show the current model and Ollama URL |
150
76
 
151
- # Instead of: npm start
152
- errbuddy npm start
77
+ > Put errbuddy's own options **before** your command: `errbuddy --model llama3.2 node app.js`. Anything after the command is passed straight through to it.
153
78
 
154
- # Instead of: java MyApp
155
- errbuddy java MyApp
79
+ ## Supported languages
156
80
 
157
- # Instead of: dotnet run
158
- errbuddy dotnet run
159
- ```
81
+ | Language | Detected errors include |
82
+ |---|---|
83
+ | JavaScript / Node.js | `TypeError`, `ReferenceError`, `SyntaxError`, missing modules |
84
+ | Java | `NullPointerException`, `ArrayIndexOutOfBoundsException`, `ClassNotFoundException`, compile errors |
85
+ | C# / .NET | `NullReferenceException`, `IndexOutOfRangeException`, `CSxxxx` compiler errors |
160
86
 
161
- ## Supported Languages
87
+ With AI enabled, errbuddy can explain other errors too; pattern matching covers the cases above.
162
88
 
163
- | Language | Status | Error Types |
164
- |----------|--------|-------------|
165
- | JavaScript/Node.js | ✅ Full | TypeError, ReferenceError, SyntaxError, Module errors |
166
- | Java | ✅ Full | NullPointer, ArrayIndex, ClassNotFound, Compile errors |
167
- | C#/.NET | ✅ Full | NullReference, Index, CS errors, Runtime exceptions |
89
+ ## How it works
168
90
 
169
- ## CLI Options
91
+ ```text
92
+ errbuddy node app.js
93
+ │
94
+ ▼
95
+ Runs your command ──► stdout is shown as normal
96
+ │ stderr is shown AND captured
97
+ ▼
98
+ Error detector ──► finds the language, error type, file and line
99
+ │
100
+ ▼
101
+ Sanitizer ──► strips file paths and anything that looks like a secret
102
+ │
103
+ ├── Ollama running? ──► local AI explains WHAT / WHY / FIX / EXAMPLE
104
+ └── Not running? ──► built-in pattern explanation
105
+ │
106
+ ▼
107
+ Formatted explanation printed under the error, then your exit code is returned
108
+ ```
170
109
 
171
- ```bash
172
- # Disable AI (use pattern matching only)
173
- errbuddy --no-ai node app.js
110
+ Want the design reasoning? See [architecture](https://github.com/sithija-jayasinghe/solution-ai-buddy-v1/blob/main/error-solution-ai-buddy/docs/architecture.md) and [design decisions](https://github.com/sithija-jayasinghe/solution-ai-buddy-v1/blob/main/error-solution-ai-buddy/docs/decisions.md).
174
111
 
175
- # Use a different Ollama model
176
- errbuddy --model codellama node app.js
112
+ ## Privacy
177
113
 
178
- # Force offline mode
179
- errbuddy --offline node app.js
114
+ - The AI runs **100% locally** through Ollama. Nothing is sent to the cloud.
115
+ - Before an error reaches the model, absolute file paths (`/Users/...`, `C:\Users\...`) are replaced with `[path]` and values that look like API keys, tokens or passwords are replaced with `[REDACTED]`.
116
+ - No telemetry, no analytics, no account.
117
+ - A local history of errors and explanations is kept in `~/.errbuddy/history.json`. Delete that file at any time to clear it.
180
118
 
181
- # Show examples
182
- errbuddy examples
119
+ ## VS Code extension
183
120
 
184
- # Show configuration
185
- errbuddy config
186
- ```
121
+ The repo also includes an Error Buddy extension for VS Code that explains errors from the integrated terminal or from selected text. It isn't on the Marketplace yet. To try it, install [`error-buddy-1.0.0.vsix`](https://github.com/sithija-jayasinghe/solution-ai-buddy-v1/tree/main/error-solution-ai-buddy/extension) with **Extensions → … → Install from VSIX**.
187
122
 
188
- ## How It Works
123
+ Commands: *Explain Selected Error*, *Explain Last Terminal Error*, *Toggle Auto-Explain*, *Open Error Buddy Terminal*, *Show Error History*.
189
124
 
190
- ```
191
- ┌─────────────────────────────────────────┐
192
- │ You run: errbuddy node app.js │
193
- └─────────────────────────────────────────┘
194
- ↓
195
- ┌─────────────────────────────────────────┐
196
- │ CLI spawns: node app.js │
197
- │ • stdout → displayed normally │
198
- │ • stderr → captured for analysis │
199
- └─────────────────────────────────────────┘
200
- ↓
201
- ┌─────────────────────────────────────────┐
202
- │ Error Detector │
203
- │ • Detects language (JS/Java/C#) │
204
- │ • Extracts error type, file, line │
205
- └─────────────────────────────────────────┘
206
- ↓
207
- ┌─────────────────────────────────────────┐
208
- │ Ollama AI (local) │
209
- │ • Receives sanitized error │
210
- │ • Returns structured explanation │
211
- └─────────────────────────────────────────┘
212
- ↓
213
- ┌─────────────────────────────────────────┐
214
- │ Pretty Terminal Output │
215
- │ • WHAT / WHY / FIX / EXAMPLE │
216
- └─────────────────────────────────────────┘
217
- ```
125
+ ## Troubleshooting
218
126
 
219
- ## Privacy & Security
127
+ **"Ollama not detected"**
128
+ 1. Open the Ollama app, or run `ollama serve`
129
+ 2. Check it responds: `curl http://localhost:11434/api/tags`
130
+ 3. Make sure you have a model: `ollama pull qwen2.5:0.5b`
220
131
 
221
- Your code **never leaves your machine**:
132
+ **The AI explanation timed out**
133
+ Your machine may be busy or the model too large. Use the default `qwen2.5:0.5b`, or run with `--offline`.
222
134
 
223
- - ✅ Ollama runs 100% locally
224
- - ✅ File paths are stripped before AI processing
225
- - ✅ No telemetry or analytics
226
- - ✅ No API keys required
227
- - ✅ Works completely offline
135
+ **`errbuddy: command not found`**
136
+ Restart your terminal. If it still fails, check that npm's global bin folder is on your `PATH` (`npm prefix -g` shows where it is).
228
137
 
229
- ## Project Structure
138
+ ## Development
230
139
 
140
+ ```bash
141
+ git clone https://github.com/sithija-jayasinghe/solution-ai-buddy-v1.git
142
+ cd solution-ai-buddy-v1/error-solution-ai-buddy
143
+ npm install
144
+ npm test # 62 tests, Node's built-in test runner
145
+ npm link # use your local copy as the global `errbuddy`
231
146
  ```
147
+
148
+ ```text
232
149
  error-solution-ai-buddy/
233
150
  ├── cli/
234
- │ ├── index.js # CLI entry point
235
- │ ├── error-listener.js # Error detection & patterns
236
- │ └── formatter.js # Terminal output formatting
237
- ├── backend/
238
- │ └── src/
239
- │ ├── ai/
240
- │ │ └── ollama-service.js # Ollama integration
241
- │ └── services/
242
- │ └── history-service.js # Error history (SQLite)
243
- ├── docs/
244
- │ ├── architecture.md # System design
245
- │ ├── decisions.md # Why we made these choices
246
- │ └── terminal-integration.md
247
- ├── tests/
248
- │ └── *.test.js
249
- ├── package.json
250
- └── README.md
151
+ │ ├── index.js # CLI entry: runs the command, wires everything together
152
+ │ ├── error-listener.js # language detection and error patterns
153
+ │ └── formatter.js # terminal output
154
+ ├── backend/src/
155
+ │ ├── ai/ollama-service.js # Ollama client, prompt and response parsing
156
+ │ └── services/history-service.js # local error history
157
+ ├── extension/ # VS Code extension (TypeScript)
158
+ ├── docs/ # architecture and design decisions
159
+ └── tests/
251
160
  ```
252
161
 
253
- ## Configuration
254
-
255
- Configuration is stored in `~/.errbuddy/config.json`:
256
-
257
- ```json
258
- {
259
- "ollamaUrl": "http://localhost:11434",
260
- "model": "llama3.2",
261
- "showSpinner": true,
262
- "saveHistory": true
263
- }
264
- ```
265
-
266
- ## Troubleshooting
267
-
268
- ### "Ollama not detected"
269
-
270
- 1. Make sure Ollama is running: `ollama serve`
271
- 2. Check it's accessible: `curl http://localhost:11434/api/tags`
272
- 3. Pull a model: `ollama pull qwen2.5:0.5b`
273
-
274
- ### "AI explanation timed out"
275
-
276
- - Try a smaller model: `errbuddy --model llama3.2:1b node app.js`
277
- - Check system resources (Ollama needs ~4GB RAM)
278
-
279
- ### Command not found after `npm link`
162
+ ## Roadmap
280
163
 
281
- - On Windows: Restart your terminal
282
- - On macOS/Linux: Check your PATH includes npm global bin
164
+ - [ ] Python and Go error patterns
165
+ - [ ] Optional cloud models (bring your own API key) for people who don't want to run Ollama
166
+ - [ ] `errbuddy history` command to search past errors
167
+ - [ ] Publish the VS Code extension to the Marketplace
283
168
 
284
169
  ## Contributing
285
170
 
286
- 1. Fork the repo
287
- 2. Create a feature branch
288
- 3. Submit a PR
171
+ Issues and pull requests are welcome. If errbuddy explained something badly, [open an issue](https://github.com/sithija-jayasinghe/solution-ai-buddy-v1/issues) with the error text so the patterns and prompts can improve.
289
172
 
290
173
  ## License
291
174
 
292
- MIT © 2024
175
+ [MIT](https://github.com/sithija-jayasinghe/solution-ai-buddy-v1/blob/main/error-solution-ai-buddy/LICENSE) © Sithija Harshana Jayasinghe
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "error-solution-ai-buddy",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "AI-powered error explanation tool for developers - works directly in your terminal",
5
5
  "type": "module",
6
6
  "main": "cli/index.js",