autodebug 0.5.1__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.
- autodebug-0.5.1/LICENSE +21 -0
- autodebug-0.5.1/PKG-INFO +251 -0
- autodebug-0.5.1/README.md +233 -0
- autodebug-0.5.1/build_backend.py +105 -0
- autodebug-0.5.1/pyproject.toml +30 -0
- autodebug-0.5.1/src/autodebug/__init__.py +3 -0
- autodebug-0.5.1/src/autodebug/__main__.py +11 -0
- autodebug-0.5.1/src/autodebug/cli.py +432 -0
- autodebug-0.5.1/src/autodebug/connection.py +219 -0
- autodebug-0.5.1/src/autodebug/extension/README.md +16 -0
- autodebug-0.5.1/src/autodebug/extension/extension.js +40 -0
- autodebug-0.5.1/src/autodebug/extension/mcp.js +98 -0
- autodebug-0.5.1/src/autodebug/extension/package.json +28 -0
- autodebug-0.5.1/src/autodebug/extension/relay.js +570 -0
- autodebug-0.5.1/src/autodebug/hub.py +267 -0
- autodebug-0.5.1/src/autodebug/install.py +346 -0
- autodebug-0.5.1/src/autodebug/mcp_server.py +270 -0
- autodebug-0.5.1/src/autodebug/redact.py +38 -0
- autodebug-0.5.1/src/autodebug/report.py +107 -0
- autodebug-0.5.1/src/autodebug/session.py +828 -0
- autodebug-0.5.1/src/autodebug/tools.py +472 -0
autodebug-0.5.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TEEJORAM
|
|
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.
|
autodebug-0.5.1/PKG-INFO
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: autodebug
|
|
3
|
+
Version: 0.5.1
|
|
4
|
+
Summary: Let an AI agent debug your program with the debugger of VS Code, Cursor or Visual Studio
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
14
|
+
Project-URL: Documentation, https://teejoram.github.io/AutoDebug/
|
|
15
|
+
Project-URL: Source, https://github.com/TEEJORAM/AutoDebug
|
|
16
|
+
Project-URL: Issues, https://github.com/TEEJORAM/AutoDebug/issues
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# AutoDebug
|
|
20
|
+
|
|
21
|
+
AutoDebug lets an AI agent debug your program with the debugger of **VS Code**,
|
|
22
|
+
**Cursor** or **Visual Studio 2022/2026**: it builds, sets breakpoints, runs,
|
|
23
|
+
steps, reads variables, and writes a root-cause report into your project.
|
|
24
|
+
Nothing runs until you click **Approve** in the IDE.
|
|
25
|
+
|
|
26
|
+
Agents: Cursor's agent, Claude Code, GitHub Copilot (VS Code and Visual
|
|
27
|
+
Studio), and any other agent that supports MCP or has a terminal.
|
|
28
|
+
|
|
29
|
+
**Documentation:** [teejoram.github.io/AutoDebug](https://teejoram.github.io/AutoDebug/)
|
|
30
|
+
|
|
31
|
+
## What you need
|
|
32
|
+
|
|
33
|
+
- **Python 3.11 or newer** and **Git**.
|
|
34
|
+
- One IDE, with the debugger for your language:
|
|
35
|
+
|
|
36
|
+
| IDE | C++ | Python |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| VS Code | **C/C++** or **CodeLLDB** extension | **Python** and **Python Debugger** extensions |
|
|
39
|
+
| Cursor | **CodeLLDB** extension (Microsoft's C/C++ debugger does not run in Cursor) | **Python** and **Python Debugger** extensions |
|
|
40
|
+
| Visual Studio 2022 or 2026 | the **Desktop development with C++** workload | not supported yet |
|
|
41
|
+
|
|
42
|
+
## Connect (about 2 minutes)
|
|
43
|
+
|
|
44
|
+
**1. Install AutoDebug.** If you use Visual Studio, close it first.
|
|
45
|
+
|
|
46
|
+
Windows (PowerShell):
|
|
47
|
+
|
|
48
|
+
```powershell
|
|
49
|
+
py -m pip install git+https://github.com/TEEJORAM/AutoDebug.git
|
|
50
|
+
py -m autodebug setup
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
macOS / Linux:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
python3 -m venv ~/.autodebug
|
|
57
|
+
~/.autodebug/bin/python -m pip install git+https://github.com/TEEJORAM/AutoDebug.git
|
|
58
|
+
~/.autodebug/bin/python -m autodebug setup
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`setup` finds every IDE and agent on the computer and connects each one: it
|
|
62
|
+
installs the AutoDebug extension (VS Code, Cursor, Visual Studio) and adds the
|
|
63
|
+
`autodebug` MCP server (VS Code, Visual Studio, Claude Code). In Cursor the
|
|
64
|
+
extension registers the server itself.
|
|
65
|
+
|
|
66
|
+
**2. Do the one step `setup` prints for your IDE:**
|
|
67
|
+
|
|
68
|
+
| IDE | Step |
|
|
69
|
+
|---|---|
|
|
70
|
+
| VS Code | Command Palette → **Developer: Reload Window**. If VS Code asks whether to trust or start the **autodebug** server, allow it. |
|
|
71
|
+
| Cursor | Command Palette → **Developer: Reload Window**, in every Cursor window. The extension registers the server with Cursor itself: **Cursor Settings → Customize → MCPs** shows **extension-autodebug**, already switched on. |
|
|
72
|
+
| Visual Studio | Start it and open your solution. Set the startup project and the **Debug** configuration. For Copilot in Visual Studio only: in the chat, **Tools** → tick **autodebug**. |
|
|
73
|
+
| Claude Code | Nothing. Start a new session. |
|
|
74
|
+
|
|
75
|
+
**3. Check:** `py -m autodebug doctor` (macOS / Linux: `~/.autodebug/bin/python -m autodebug doctor`).
|
|
76
|
+
It lists the connected IDEs, the open IDE windows and what to fix.
|
|
77
|
+
|
|
78
|
+
**Optional, per project:** `py -m autodebug setup C:\path\to\project` also
|
|
79
|
+
writes an AutoDebug section into the project's `AGENTS.md`. Agents read it and
|
|
80
|
+
use the terminal when their app hides the MCP tools (see below).
|
|
81
|
+
|
|
82
|
+
## Which agent debugs in which IDE
|
|
83
|
+
|
|
84
|
+
The agent and the IDE are separate. Any connected agent can debug in any IDE
|
|
85
|
+
window that runs the AutoDebug extension:
|
|
86
|
+
|
|
87
|
+
- **Cursor's agent** debugs in Cursor, VS Code or Visual Studio.
|
|
88
|
+
- **Claude Code** debugs in VS Code, Cursor or Visual Studio.
|
|
89
|
+
- **Copilot** debugs in VS Code (agent mode), or in Visual Studio (agent mode).
|
|
90
|
+
|
|
91
|
+
When windows of more than one IDE are open, name the IDE in the prompt, for
|
|
92
|
+
example "use the Visual Studio window".
|
|
93
|
+
|
|
94
|
+
## Debug
|
|
95
|
+
|
|
96
|
+
Open the project in the IDE and ask the agent, for example:
|
|
97
|
+
|
|
98
|
+
> The app crashes when I delete the last item in a list. Use the autodebug
|
|
99
|
+
> tools: build the Debug configuration, stop where the item is removed, find
|
|
100
|
+
> the root cause and write a report.
|
|
101
|
+
|
|
102
|
+
1. The IDE shows the **Approve** dialog with the goal, the build, the program,
|
|
103
|
+
the breakpoints and the limits. Click **Approve** within 2 minutes.
|
|
104
|
+
2. The agent builds, stops at the breakpoints, steps and traces.
|
|
105
|
+
3. The report is written to `autodebug-reports/` in the project folder.
|
|
106
|
+
|
|
107
|
+
Try it first on [examples/AutoDebugDemo](https://github.com/TEEJORAM/AutoDebug/blob/main/examples/AutoDebugDemo/README.md):
|
|
108
|
+
the same bug in C++ and Python.
|
|
109
|
+
|
|
110
|
+
## When the agent cannot see the autodebug tools
|
|
111
|
+
|
|
112
|
+
Some apps drop MCP tools from a chat without an error. The agent can then run
|
|
113
|
+
the same tools in its terminal, in the same debug session:
|
|
114
|
+
|
|
115
|
+
```powershell
|
|
116
|
+
py -m autodebug run list_targets ide=visualstudio
|
|
117
|
+
py -m autodebug run help
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`autodebug setup <project folder>` writes the exact command for your computer
|
|
121
|
+
into the project's `AGENTS.md`, so the agent finds it by itself.
|
|
122
|
+
|
|
123
|
+
## Troubleshooting
|
|
124
|
+
|
|
125
|
+
| What you see | What to do |
|
|
126
|
+
|---|---|
|
|
127
|
+
| The agent has no autodebug tools | Cursor: reload the window and start a new chat; **Settings → Customize → MCPs** should show **extension-autodebug** with a green dot. `autodebug doctor` flags an old `mcp.json` entry that gets in the way. Visual Studio Copilot: **Tools** → tick **autodebug**. Any agent: it can use `autodebug run` (above). |
|
|
128
|
+
| "No VS Code, Cursor or Visual Studio window is running the extension" | Open the project in the IDE. VS Code / Cursor: **Developer: Reload Window**; the status bar shows **AutoDebug**. Visual Studio: View → Output → **AutoDebug** says it is listening. |
|
|
129
|
+
| No Approve dialog | Switch to the IDE window: the dialog opens there (in Visual Studio it stays on top of other windows). The agent reports "no answer within 2 minutes" when nobody answered. |
|
|
130
|
+
| `NOT_BUILT` | The program has not been built. The agent retries with the build task it names. |
|
|
131
|
+
| Visual Studio is open during setup | Close every Visual Studio window, then run `setup` again. |
|
|
132
|
+
| No debugger for type "…" | Install that debugger extension in the IDE (table above) and reload the window. |
|
|
133
|
+
|
|
134
|
+
## Update
|
|
135
|
+
|
|
136
|
+
```powershell
|
|
137
|
+
py -m pip install --force-reinstall git+https://github.com/TEEJORAM/AutoDebug.git
|
|
138
|
+
py -m autodebug setup
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Commands
|
|
142
|
+
|
|
143
|
+
| Command | Does |
|
|
144
|
+
|---|---|
|
|
145
|
+
| `autodebug setup` | Connect every IDE and agent found. `setup cursor`, `vscode`, `visualstudio` or `claude` connects one; add a project folder for project-only entries and `AGENTS.md` |
|
|
146
|
+
| `autodebug doctor [folder]` | Check the setup, the open IDE windows and the AutoDebug service |
|
|
147
|
+
| `autodebug run <tool> key=value …` | Call a debugging tool from a terminal; `run help` lists them |
|
|
148
|
+
| `autodebug serve` | The MCP server; the IDE or agent starts it |
|
|
149
|
+
|
|
150
|
+
On Windows write `py -m autodebug`; on macOS / Linux `~/.autodebug/bin/python -m autodebug`.
|
|
151
|
+
|
|
152
|
+
## Agent tools
|
|
153
|
+
|
|
154
|
+
| Tool | What it does |
|
|
155
|
+
|---|---|
|
|
156
|
+
| `list_targets` | IDE windows, their launch configurations and build tasks |
|
|
157
|
+
| `start_session` | Approval, build, breakpoints, launch or attach; waits for the first stop |
|
|
158
|
+
| `wait` · `pause` · `stop_session` | Follow, interrupt or end the session. `wait` can `ask_developer` to reproduce a GUI step |
|
|
159
|
+
| `step` | Over, into or out, 1–20 times, with the variables that changed |
|
|
160
|
+
| `continue` | Run to the next stop, or past other breakpoints to a line |
|
|
161
|
+
| `inspect` · `stack` · `threads` | Variables (including nested paths), the call stack, and threads |
|
|
162
|
+
| `breakpoints` · `exceptions` | Source and function breakpoints; exception filters |
|
|
163
|
+
| `trace` | Collect variables every time a line runs |
|
|
164
|
+
| `write_report` | Root-cause report in `autodebug-reports/` with a timeline of the session |
|
|
165
|
+
|
|
166
|
+
The agent cannot evaluate expressions or change variables, and secret-looking
|
|
167
|
+
values are hidden from it. AutoDebug listens on 127.0.0.1 only, with a token.
|
|
168
|
+
How it works: [docs/design.md](https://github.com/TEEJORAM/AutoDebug/blob/main/docs/design.md).
|
|
169
|
+
|
|
170
|
+
AutoDebug is released under the [MIT License](https://github.com/TEEJORAM/AutoDebug/blob/main/LICENSE).
|
|
171
|
+
|
|
172
|
+
## Large C++ programs
|
|
173
|
+
|
|
174
|
+
**Build with symbols.** Debug the `Debug` or `RelWithDebInfo` build; optimised
|
|
175
|
+
builds without debug info show wrong lines and missing variables. Let the
|
|
176
|
+
build run first through the launch configuration's `preLaunchTask` or the
|
|
177
|
+
agent's `build_task`. A long compile gets `build_minutes` (default 30, up to
|
|
178
|
+
600), separate from the debugging time limit.
|
|
179
|
+
|
|
180
|
+
**Launch configurations.** For example, in `.vscode/launch.json`:
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"name": "Debug app (CodeLLDB)",
|
|
185
|
+
"type": "lldb",
|
|
186
|
+
"request": "launch",
|
|
187
|
+
"program": "${workspaceFolder}/build/bin/app",
|
|
188
|
+
"cwd": "${workspaceFolder}",
|
|
189
|
+
"preLaunchTask": "build",
|
|
190
|
+
"windows": { "program": "${workspaceFolder}/build/bin/Debug/app.exe" }
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "Attach to app (CodeLLDB)",
|
|
194
|
+
"type": "lldb",
|
|
195
|
+
"request": "attach",
|
|
196
|
+
"pid": "${command:pickMyProcess}"
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The Approve dialog shows the whole configuration, the build commands with
|
|
201
|
+
everything they depend on, and the environment. Configurations that prompt for
|
|
202
|
+
input or debug another computer are refused.
|
|
203
|
+
|
|
204
|
+
**Attach to a running application.** Start the app yourself, get to the state
|
|
205
|
+
just before the bug, and have the agent attach with `process_id`. When the
|
|
206
|
+
session ends the debugger detaches and the app keeps running.
|
|
207
|
+
|
|
208
|
+
**What helps in a big codebase:**
|
|
209
|
+
|
|
210
|
+
- **Slow starts.** Loading symbols for a large binary can take minutes; the
|
|
211
|
+
agent keeps calling `wait`.
|
|
212
|
+
- **Shared libraries and plugins.** Breakpoints in them bind when the library
|
|
213
|
+
loads; until then they show as not bound yet, with the debugger's reason.
|
|
214
|
+
- **Code outside the workspace.** Pass `source_folders` for third-party
|
|
215
|
+
libraries or an SDK that live outside the project folder.
|
|
216
|
+
- **Threads.** `threads` lists them and selects one for `stack`, `inspect` and
|
|
217
|
+
`step`.
|
|
218
|
+
- **Deep stacks.** `stack` pages through up to 200 frames at a time.
|
|
219
|
+
- **Objects and containers.** `inspect` with `depth` 1–3 opens structs, pointers
|
|
220
|
+
and containers. Names can be paths: `scene->objects[2].transform`.
|
|
221
|
+
- **Exceptions.** `exceptions` lists the debugger's exception filters (CodeLLDB
|
|
222
|
+
offers C++ throw and catch) and turns them on. A stop on an exception reports
|
|
223
|
+
which one.
|
|
224
|
+
- **GUI reproduction.** `wait` with `ask_developer` shows you a note such as
|
|
225
|
+
"Click Delete on the last item". You do it, and the program stops at the
|
|
226
|
+
breakpoint.
|
|
227
|
+
- **Embedded Python.** If the application embeds Python, start debugpy inside
|
|
228
|
+
it and attach with a debugpy configuration (the sample has
|
|
229
|
+
**Attach to Python (port 5678)**).
|
|
230
|
+
- **Function breakpoints.** Break on `Document::removeItem` without knowing the file.
|
|
231
|
+
|
|
232
|
+
Values the agent reads are sent to the AI model, like any other tool result.
|
|
233
|
+
Debug only programs and data you are allowed to share with it.
|
|
234
|
+
|
|
235
|
+
## Develop
|
|
236
|
+
|
|
237
|
+
```sh
|
|
238
|
+
PYTHONPATH=src python -m unittest discover -s tests
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
All of AutoDebug's logic is Python (`src/autodebug`). The IDE extension is a
|
|
242
|
+
small JavaScript relay (`src/autodebug/extension/relay.js`) for VS Code and
|
|
243
|
+
Cursor, and a C# relay (`src/autodebug/visualstudio`) for Visual Studio. The
|
|
244
|
+
relays show the Approve dialog and pass debugger requests and events through.
|
|
245
|
+
|
|
246
|
+
To work on AutoDebug itself, clone the repository and install it editable:
|
|
247
|
+
`py -m pip install -e .` (Windows) or `python3 -m pip install -e .`.
|
|
248
|
+
|
|
249
|
+
Most tests run with Python alone. The relay tests need Node.js. The
|
|
250
|
+
real-debugger tests also need `pip install debugpy` (Python) and gdb 14 or later
|
|
251
|
+
with g++ (C++, Linux and macOS). See [CLAUDE.md](https://github.com/TEEJORAM/AutoDebug/blob/main/CLAUDE.md) for the rules.
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# AutoDebug
|
|
2
|
+
|
|
3
|
+
AutoDebug lets an AI agent debug your program with the debugger of **VS Code**,
|
|
4
|
+
**Cursor** or **Visual Studio 2022/2026**: it builds, sets breakpoints, runs,
|
|
5
|
+
steps, reads variables, and writes a root-cause report into your project.
|
|
6
|
+
Nothing runs until you click **Approve** in the IDE.
|
|
7
|
+
|
|
8
|
+
Agents: Cursor's agent, Claude Code, GitHub Copilot (VS Code and Visual
|
|
9
|
+
Studio), and any other agent that supports MCP or has a terminal.
|
|
10
|
+
|
|
11
|
+
**Documentation:** [teejoram.github.io/AutoDebug](https://teejoram.github.io/AutoDebug/)
|
|
12
|
+
|
|
13
|
+
## What you need
|
|
14
|
+
|
|
15
|
+
- **Python 3.11 or newer** and **Git**.
|
|
16
|
+
- One IDE, with the debugger for your language:
|
|
17
|
+
|
|
18
|
+
| IDE | C++ | Python |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| VS Code | **C/C++** or **CodeLLDB** extension | **Python** and **Python Debugger** extensions |
|
|
21
|
+
| Cursor | **CodeLLDB** extension (Microsoft's C/C++ debugger does not run in Cursor) | **Python** and **Python Debugger** extensions |
|
|
22
|
+
| Visual Studio 2022 or 2026 | the **Desktop development with C++** workload | not supported yet |
|
|
23
|
+
|
|
24
|
+
## Connect (about 2 minutes)
|
|
25
|
+
|
|
26
|
+
**1. Install AutoDebug.** If you use Visual Studio, close it first.
|
|
27
|
+
|
|
28
|
+
Windows (PowerShell):
|
|
29
|
+
|
|
30
|
+
```powershell
|
|
31
|
+
py -m pip install git+https://github.com/TEEJORAM/AutoDebug.git
|
|
32
|
+
py -m autodebug setup
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
macOS / Linux:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
python3 -m venv ~/.autodebug
|
|
39
|
+
~/.autodebug/bin/python -m pip install git+https://github.com/TEEJORAM/AutoDebug.git
|
|
40
|
+
~/.autodebug/bin/python -m autodebug setup
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`setup` finds every IDE and agent on the computer and connects each one: it
|
|
44
|
+
installs the AutoDebug extension (VS Code, Cursor, Visual Studio) and adds the
|
|
45
|
+
`autodebug` MCP server (VS Code, Visual Studio, Claude Code). In Cursor the
|
|
46
|
+
extension registers the server itself.
|
|
47
|
+
|
|
48
|
+
**2. Do the one step `setup` prints for your IDE:**
|
|
49
|
+
|
|
50
|
+
| IDE | Step |
|
|
51
|
+
|---|---|
|
|
52
|
+
| VS Code | Command Palette → **Developer: Reload Window**. If VS Code asks whether to trust or start the **autodebug** server, allow it. |
|
|
53
|
+
| Cursor | Command Palette → **Developer: Reload Window**, in every Cursor window. The extension registers the server with Cursor itself: **Cursor Settings → Customize → MCPs** shows **extension-autodebug**, already switched on. |
|
|
54
|
+
| Visual Studio | Start it and open your solution. Set the startup project and the **Debug** configuration. For Copilot in Visual Studio only: in the chat, **Tools** → tick **autodebug**. |
|
|
55
|
+
| Claude Code | Nothing. Start a new session. |
|
|
56
|
+
|
|
57
|
+
**3. Check:** `py -m autodebug doctor` (macOS / Linux: `~/.autodebug/bin/python -m autodebug doctor`).
|
|
58
|
+
It lists the connected IDEs, the open IDE windows and what to fix.
|
|
59
|
+
|
|
60
|
+
**Optional, per project:** `py -m autodebug setup C:\path\to\project` also
|
|
61
|
+
writes an AutoDebug section into the project's `AGENTS.md`. Agents read it and
|
|
62
|
+
use the terminal when their app hides the MCP tools (see below).
|
|
63
|
+
|
|
64
|
+
## Which agent debugs in which IDE
|
|
65
|
+
|
|
66
|
+
The agent and the IDE are separate. Any connected agent can debug in any IDE
|
|
67
|
+
window that runs the AutoDebug extension:
|
|
68
|
+
|
|
69
|
+
- **Cursor's agent** debugs in Cursor, VS Code or Visual Studio.
|
|
70
|
+
- **Claude Code** debugs in VS Code, Cursor or Visual Studio.
|
|
71
|
+
- **Copilot** debugs in VS Code (agent mode), or in Visual Studio (agent mode).
|
|
72
|
+
|
|
73
|
+
When windows of more than one IDE are open, name the IDE in the prompt, for
|
|
74
|
+
example "use the Visual Studio window".
|
|
75
|
+
|
|
76
|
+
## Debug
|
|
77
|
+
|
|
78
|
+
Open the project in the IDE and ask the agent, for example:
|
|
79
|
+
|
|
80
|
+
> The app crashes when I delete the last item in a list. Use the autodebug
|
|
81
|
+
> tools: build the Debug configuration, stop where the item is removed, find
|
|
82
|
+
> the root cause and write a report.
|
|
83
|
+
|
|
84
|
+
1. The IDE shows the **Approve** dialog with the goal, the build, the program,
|
|
85
|
+
the breakpoints and the limits. Click **Approve** within 2 minutes.
|
|
86
|
+
2. The agent builds, stops at the breakpoints, steps and traces.
|
|
87
|
+
3. The report is written to `autodebug-reports/` in the project folder.
|
|
88
|
+
|
|
89
|
+
Try it first on [examples/AutoDebugDemo](https://github.com/TEEJORAM/AutoDebug/blob/main/examples/AutoDebugDemo/README.md):
|
|
90
|
+
the same bug in C++ and Python.
|
|
91
|
+
|
|
92
|
+
## When the agent cannot see the autodebug tools
|
|
93
|
+
|
|
94
|
+
Some apps drop MCP tools from a chat without an error. The agent can then run
|
|
95
|
+
the same tools in its terminal, in the same debug session:
|
|
96
|
+
|
|
97
|
+
```powershell
|
|
98
|
+
py -m autodebug run list_targets ide=visualstudio
|
|
99
|
+
py -m autodebug run help
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`autodebug setup <project folder>` writes the exact command for your computer
|
|
103
|
+
into the project's `AGENTS.md`, so the agent finds it by itself.
|
|
104
|
+
|
|
105
|
+
## Troubleshooting
|
|
106
|
+
|
|
107
|
+
| What you see | What to do |
|
|
108
|
+
|---|---|
|
|
109
|
+
| The agent has no autodebug tools | Cursor: reload the window and start a new chat; **Settings → Customize → MCPs** should show **extension-autodebug** with a green dot. `autodebug doctor` flags an old `mcp.json` entry that gets in the way. Visual Studio Copilot: **Tools** → tick **autodebug**. Any agent: it can use `autodebug run` (above). |
|
|
110
|
+
| "No VS Code, Cursor or Visual Studio window is running the extension" | Open the project in the IDE. VS Code / Cursor: **Developer: Reload Window**; the status bar shows **AutoDebug**. Visual Studio: View → Output → **AutoDebug** says it is listening. |
|
|
111
|
+
| No Approve dialog | Switch to the IDE window: the dialog opens there (in Visual Studio it stays on top of other windows). The agent reports "no answer within 2 minutes" when nobody answered. |
|
|
112
|
+
| `NOT_BUILT` | The program has not been built. The agent retries with the build task it names. |
|
|
113
|
+
| Visual Studio is open during setup | Close every Visual Studio window, then run `setup` again. |
|
|
114
|
+
| No debugger for type "…" | Install that debugger extension in the IDE (table above) and reload the window. |
|
|
115
|
+
|
|
116
|
+
## Update
|
|
117
|
+
|
|
118
|
+
```powershell
|
|
119
|
+
py -m pip install --force-reinstall git+https://github.com/TEEJORAM/AutoDebug.git
|
|
120
|
+
py -m autodebug setup
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Commands
|
|
124
|
+
|
|
125
|
+
| Command | Does |
|
|
126
|
+
|---|---|
|
|
127
|
+
| `autodebug setup` | Connect every IDE and agent found. `setup cursor`, `vscode`, `visualstudio` or `claude` connects one; add a project folder for project-only entries and `AGENTS.md` |
|
|
128
|
+
| `autodebug doctor [folder]` | Check the setup, the open IDE windows and the AutoDebug service |
|
|
129
|
+
| `autodebug run <tool> key=value …` | Call a debugging tool from a terminal; `run help` lists them |
|
|
130
|
+
| `autodebug serve` | The MCP server; the IDE or agent starts it |
|
|
131
|
+
|
|
132
|
+
On Windows write `py -m autodebug`; on macOS / Linux `~/.autodebug/bin/python -m autodebug`.
|
|
133
|
+
|
|
134
|
+
## Agent tools
|
|
135
|
+
|
|
136
|
+
| Tool | What it does |
|
|
137
|
+
|---|---|
|
|
138
|
+
| `list_targets` | IDE windows, their launch configurations and build tasks |
|
|
139
|
+
| `start_session` | Approval, build, breakpoints, launch or attach; waits for the first stop |
|
|
140
|
+
| `wait` · `pause` · `stop_session` | Follow, interrupt or end the session. `wait` can `ask_developer` to reproduce a GUI step |
|
|
141
|
+
| `step` | Over, into or out, 1–20 times, with the variables that changed |
|
|
142
|
+
| `continue` | Run to the next stop, or past other breakpoints to a line |
|
|
143
|
+
| `inspect` · `stack` · `threads` | Variables (including nested paths), the call stack, and threads |
|
|
144
|
+
| `breakpoints` · `exceptions` | Source and function breakpoints; exception filters |
|
|
145
|
+
| `trace` | Collect variables every time a line runs |
|
|
146
|
+
| `write_report` | Root-cause report in `autodebug-reports/` with a timeline of the session |
|
|
147
|
+
|
|
148
|
+
The agent cannot evaluate expressions or change variables, and secret-looking
|
|
149
|
+
values are hidden from it. AutoDebug listens on 127.0.0.1 only, with a token.
|
|
150
|
+
How it works: [docs/design.md](https://github.com/TEEJORAM/AutoDebug/blob/main/docs/design.md).
|
|
151
|
+
|
|
152
|
+
AutoDebug is released under the [MIT License](https://github.com/TEEJORAM/AutoDebug/blob/main/LICENSE).
|
|
153
|
+
|
|
154
|
+
## Large C++ programs
|
|
155
|
+
|
|
156
|
+
**Build with symbols.** Debug the `Debug` or `RelWithDebInfo` build; optimised
|
|
157
|
+
builds without debug info show wrong lines and missing variables. Let the
|
|
158
|
+
build run first through the launch configuration's `preLaunchTask` or the
|
|
159
|
+
agent's `build_task`. A long compile gets `build_minutes` (default 30, up to
|
|
160
|
+
600), separate from the debugging time limit.
|
|
161
|
+
|
|
162
|
+
**Launch configurations.** For example, in `.vscode/launch.json`:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"name": "Debug app (CodeLLDB)",
|
|
167
|
+
"type": "lldb",
|
|
168
|
+
"request": "launch",
|
|
169
|
+
"program": "${workspaceFolder}/build/bin/app",
|
|
170
|
+
"cwd": "${workspaceFolder}",
|
|
171
|
+
"preLaunchTask": "build",
|
|
172
|
+
"windows": { "program": "${workspaceFolder}/build/bin/Debug/app.exe" }
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "Attach to app (CodeLLDB)",
|
|
176
|
+
"type": "lldb",
|
|
177
|
+
"request": "attach",
|
|
178
|
+
"pid": "${command:pickMyProcess}"
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The Approve dialog shows the whole configuration, the build commands with
|
|
183
|
+
everything they depend on, and the environment. Configurations that prompt for
|
|
184
|
+
input or debug another computer are refused.
|
|
185
|
+
|
|
186
|
+
**Attach to a running application.** Start the app yourself, get to the state
|
|
187
|
+
just before the bug, and have the agent attach with `process_id`. When the
|
|
188
|
+
session ends the debugger detaches and the app keeps running.
|
|
189
|
+
|
|
190
|
+
**What helps in a big codebase:**
|
|
191
|
+
|
|
192
|
+
- **Slow starts.** Loading symbols for a large binary can take minutes; the
|
|
193
|
+
agent keeps calling `wait`.
|
|
194
|
+
- **Shared libraries and plugins.** Breakpoints in them bind when the library
|
|
195
|
+
loads; until then they show as not bound yet, with the debugger's reason.
|
|
196
|
+
- **Code outside the workspace.** Pass `source_folders` for third-party
|
|
197
|
+
libraries or an SDK that live outside the project folder.
|
|
198
|
+
- **Threads.** `threads` lists them and selects one for `stack`, `inspect` and
|
|
199
|
+
`step`.
|
|
200
|
+
- **Deep stacks.** `stack` pages through up to 200 frames at a time.
|
|
201
|
+
- **Objects and containers.** `inspect` with `depth` 1–3 opens structs, pointers
|
|
202
|
+
and containers. Names can be paths: `scene->objects[2].transform`.
|
|
203
|
+
- **Exceptions.** `exceptions` lists the debugger's exception filters (CodeLLDB
|
|
204
|
+
offers C++ throw and catch) and turns them on. A stop on an exception reports
|
|
205
|
+
which one.
|
|
206
|
+
- **GUI reproduction.** `wait` with `ask_developer` shows you a note such as
|
|
207
|
+
"Click Delete on the last item". You do it, and the program stops at the
|
|
208
|
+
breakpoint.
|
|
209
|
+
- **Embedded Python.** If the application embeds Python, start debugpy inside
|
|
210
|
+
it and attach with a debugpy configuration (the sample has
|
|
211
|
+
**Attach to Python (port 5678)**).
|
|
212
|
+
- **Function breakpoints.** Break on `Document::removeItem` without knowing the file.
|
|
213
|
+
|
|
214
|
+
Values the agent reads are sent to the AI model, like any other tool result.
|
|
215
|
+
Debug only programs and data you are allowed to share with it.
|
|
216
|
+
|
|
217
|
+
## Develop
|
|
218
|
+
|
|
219
|
+
```sh
|
|
220
|
+
PYTHONPATH=src python -m unittest discover -s tests
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
All of AutoDebug's logic is Python (`src/autodebug`). The IDE extension is a
|
|
224
|
+
small JavaScript relay (`src/autodebug/extension/relay.js`) for VS Code and
|
|
225
|
+
Cursor, and a C# relay (`src/autodebug/visualstudio`) for Visual Studio. The
|
|
226
|
+
relays show the Approve dialog and pass debugger requests and events through.
|
|
227
|
+
|
|
228
|
+
To work on AutoDebug itself, clone the repository and install it editable:
|
|
229
|
+
`py -m pip install -e .` (Windows) or `python3 -m pip install -e .`.
|
|
230
|
+
|
|
231
|
+
Most tests run with Python alone. The relay tests need Node.js. The
|
|
232
|
+
real-debugger tests also need `pip install debugpy` (Python) and gdb 14 or later
|
|
233
|
+
with g++ (C++, Linux and macOS). See [CLAUDE.md](https://github.com/TEEJORAM/AutoDebug/blob/main/CLAUDE.md) for the rules.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""Standard-library PEP 517 backend: builds AutoDebug without downloading anything."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import base64
|
|
6
|
+
import csv
|
|
7
|
+
import hashlib
|
|
8
|
+
import io
|
|
9
|
+
import tarfile
|
|
10
|
+
import tomllib
|
|
11
|
+
import zipfile
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
ROOT = Path(__file__).resolve().parent
|
|
15
|
+
PROJECT = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))["project"]
|
|
16
|
+
NAME, VERSION = PROJECT["name"], PROJECT["version"]
|
|
17
|
+
DIST_INFO = f"{NAME}-{VERSION}.dist-info"
|
|
18
|
+
PACKAGE = ROOT / "src" / "autodebug"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _package_files() -> list[Path]:
|
|
22
|
+
"""Python modules plus the extension sources the wheel must carry."""
|
|
23
|
+
files = [p for p in PACKAGE.rglob("*.py") if "__pycache__" not in p.parts]
|
|
24
|
+
files += [p for p in (PACKAGE / "extension").glob("*") if p.suffix in (".js", ".json", ".md")]
|
|
25
|
+
return sorted(files)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _metadata() -> dict[str, bytes]:
|
|
29
|
+
scripts = "\n".join(f"{name} = {target}" for name, target in PROJECT.get("scripts", {}).items())
|
|
30
|
+
headers = [f"Metadata-Version: 2.1", f"Name: {NAME}", f"Version: {VERSION}", f"Summary: {PROJECT['description']}",
|
|
31
|
+
f"Requires-Python: {PROJECT['requires-python']}"]
|
|
32
|
+
if PROJECT.get("license"):
|
|
33
|
+
headers.append(f"License: {PROJECT['license']}")
|
|
34
|
+
headers += [f"Classifier: {c}" for c in PROJECT.get("classifiers", [])]
|
|
35
|
+
headers += [f"Project-URL: {label}, {url}" for label, url in PROJECT.get("urls", {}).items()]
|
|
36
|
+
readme = (ROOT / PROJECT["readme"]).read_text(encoding="utf-8") if PROJECT.get("readme") else ""
|
|
37
|
+
if readme:
|
|
38
|
+
headers.append("Description-Content-Type: text/markdown")
|
|
39
|
+
return {
|
|
40
|
+
"METADATA": ("\n".join(headers) + "\n\n" + readme).encode("utf-8"),
|
|
41
|
+
"WHEEL": b"Wheel-Version: 1.0\nGenerator: autodebug\nRoot-Is-Purelib: true\nTag: py3-none-any\n",
|
|
42
|
+
"entry_points.txt": f"[console_scripts]\n{scripts}\n".encode(),
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _wheel(directory: str, editable: bool) -> str:
|
|
47
|
+
filename = f"{NAME}-{VERSION}-py3-none-any.whl"
|
|
48
|
+
records = []
|
|
49
|
+
with zipfile.ZipFile(Path(directory) / filename, "w", zipfile.ZIP_DEFLATED) as wheel:
|
|
50
|
+
def add(name: str, data: bytes) -> None:
|
|
51
|
+
wheel.writestr(name, data)
|
|
52
|
+
digest = base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b"=").decode()
|
|
53
|
+
records.append((name, f"sha256={digest}", str(len(data))))
|
|
54
|
+
|
|
55
|
+
if editable:
|
|
56
|
+
add(f"__editable__.{NAME}.pth", f"{ROOT / 'src'}\n".encode())
|
|
57
|
+
else:
|
|
58
|
+
for path in _package_files():
|
|
59
|
+
add(path.relative_to(ROOT / "src").as_posix(), path.read_bytes())
|
|
60
|
+
for name, data in _metadata().items():
|
|
61
|
+
add(f"{DIST_INFO}/{name}", data)
|
|
62
|
+
record = io.StringIO()
|
|
63
|
+
csv.writer(record, lineterminator="\n").writerows([*records, (f"{DIST_INFO}/RECORD", "", "")])
|
|
64
|
+
wheel.writestr(f"{DIST_INFO}/RECORD", record.getvalue())
|
|
65
|
+
return filename
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def get_requires_for_build_wheel(config_settings=None):
|
|
69
|
+
return []
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
get_requires_for_build_editable = get_requires_for_build_sdist = get_requires_for_build_wheel
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
|
|
76
|
+
folder = Path(metadata_directory) / DIST_INFO
|
|
77
|
+
folder.mkdir(parents=True, exist_ok=True)
|
|
78
|
+
for name, data in _metadata().items():
|
|
79
|
+
(folder / name).write_bytes(data)
|
|
80
|
+
return DIST_INFO
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
prepare_metadata_for_build_editable = prepare_metadata_for_build_wheel
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
|
|
87
|
+
return _wheel(wheel_directory, editable=False)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def build_editable(wheel_directory, config_settings=None, metadata_directory=None):
|
|
91
|
+
return _wheel(wheel_directory, editable=True)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def build_sdist(sdist_directory, config_settings=None):
|
|
95
|
+
filename = f"{NAME}-{VERSION}.tar.gz"
|
|
96
|
+
prefix = f"{NAME}-{VERSION}"
|
|
97
|
+
with tarfile.open(Path(sdist_directory) / filename, "w:gz") as archive:
|
|
98
|
+
metadata = _metadata()["METADATA"]
|
|
99
|
+
info = tarfile.TarInfo(f"{prefix}/PKG-INFO")
|
|
100
|
+
info.size = len(metadata)
|
|
101
|
+
archive.addfile(info, io.BytesIO(metadata))
|
|
102
|
+
for path in [ROOT / "pyproject.toml", ROOT / "build_backend.py", ROOT / "README.md", ROOT / "LICENSE",
|
|
103
|
+
*_package_files()]:
|
|
104
|
+
archive.add(path, arcname=f"{prefix}/{path.relative_to(ROOT).as_posix()}", recursive=False)
|
|
105
|
+
return filename
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "autodebug"
|
|
3
|
+
version = "0.5.1"
|
|
4
|
+
description = "Let an AI agent debug your program with the debugger of VS Code, Cursor or Visual Studio"
|
|
5
|
+
requires-python = ">=3.11"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Development Status :: 4 - Beta",
|
|
10
|
+
"License :: OSI Approved :: MIT License",
|
|
11
|
+
"Environment :: Console",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Operating System :: OS Independent",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Topic :: Software Development :: Debuggers",
|
|
16
|
+
]
|
|
17
|
+
dependencies = []
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Documentation = "https://teejoram.github.io/AutoDebug/"
|
|
21
|
+
Source = "https://github.com/TEEJORAM/AutoDebug"
|
|
22
|
+
Issues = "https://github.com/TEEJORAM/AutoDebug/issues"
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
autodebug = "autodebug.cli:main"
|
|
26
|
+
|
|
27
|
+
[build-system]
|
|
28
|
+
requires = []
|
|
29
|
+
build-backend = "build_backend"
|
|
30
|
+
backend-path = ["."]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
if not __package__: # run as `python <checkout>/src/autodebug`: no install or PYTHONPATH needed
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
here = os.path.dirname(os.path.abspath(__file__))
|
|
6
|
+
sys.path[:] = [p for p in sys.path if os.path.abspath(p or ".") != here]
|
|
7
|
+
sys.path.insert(0, os.path.dirname(here))
|
|
8
|
+
|
|
9
|
+
from autodebug.cli import main
|
|
10
|
+
|
|
11
|
+
raise SystemExit(main())
|