abapgit-agent 1.9.0 → 1.10.0
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 +22 -0
- package/abap/CLAUDE.md +104 -72
- package/bin/abapgit-agent +1 -0
- package/package.json +6 -1
- package/src/commands/debug.js +1390 -0
- package/src/utils/adt-http.js +344 -0
- package/src/utils/debug-daemon.js +207 -0
- package/src/utils/debug-render.js +69 -0
- package/src/utils/debug-repl.js +256 -0
- package/src/utils/debug-session.js +845 -0
- package/src/utils/debug-state.js +124 -0
package/README.md
CHANGED
|
@@ -150,6 +150,27 @@ abapgit-agent dump --date TODAY
|
|
|
150
150
|
abapgit-agent dump --user DEVELOPER --date TODAY --detail 1
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
+
### Debug Commands
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Set a breakpoint
|
|
157
|
+
abapgit-agent debug set --files abap/zcl_my_class.clas.abap:42
|
|
158
|
+
|
|
159
|
+
# Attach and debug interactively (human REPL)
|
|
160
|
+
abapgit-agent debug attach
|
|
161
|
+
|
|
162
|
+
# Attach in scripted AI mode — emits JSON on hit, starts background daemon
|
|
163
|
+
abapgit-agent debug attach --json
|
|
164
|
+
|
|
165
|
+
# Step, inspect variables, call stack (no --session needed)
|
|
166
|
+
abapgit-agent debug step --type over --json
|
|
167
|
+
abapgit-agent debug vars --json
|
|
168
|
+
abapgit-agent debug stack --json
|
|
169
|
+
|
|
170
|
+
# Always release the frozen work process when done
|
|
171
|
+
abapgit-agent debug step --type continue --json
|
|
172
|
+
```
|
|
173
|
+
|
|
153
174
|
### Utility Commands
|
|
154
175
|
|
|
155
176
|
```bash
|
|
@@ -193,6 +214,7 @@ npm run pull -- --url <git-url> --branch main
|
|
|
193
214
|
| preview Command | [docs/preview-command.md](docs/preview-command.md) |
|
|
194
215
|
| where Command | [docs/where-command.md](docs/where-command.md) |
|
|
195
216
|
| dump Command | [docs/dump-command.md](docs/dump-command.md) |
|
|
217
|
+
| debug Command | [docs/debug-command.md](docs/debug-command.md) |
|
|
196
218
|
| ref Command | [docs/ref-command.md](docs/ref-command.md) |
|
|
197
219
|
| REST API Reference | [API.md](API.md) |
|
|
198
220
|
| Error Handling | [ERROR_HANDLING.md](ERROR_HANDLING.md) |
|
package/abap/CLAUDE.md
CHANGED
|
@@ -256,106 +256,138 @@ abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.cla
|
|
|
256
256
|
|
|
257
257
|
---
|
|
258
258
|
|
|
259
|
-
### 9.
|
|
259
|
+
### 9. Troubleshooting ABAP Issues
|
|
260
260
|
|
|
261
|
-
|
|
261
|
+
Two commands are available for investigating bugs at runtime:
|
|
262
262
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
```
|
|
263
|
+
| Command | Use when | What it gives you |
|
|
264
|
+
|---------|----------|-------------------|
|
|
265
|
+
| `dump` | Error already occurred (ST22 crash) | Error type, call stack, exact source line |
|
|
266
|
+
| `debug` | Need to trace logic step-by-step | Live variable values, step into/over, expand structures |
|
|
268
267
|
|
|
269
|
-
#### When
|
|
268
|
+
#### When Something Goes Wrong — Start with `dump`
|
|
270
269
|
|
|
271
|
-
|
|
272
|
-
|----------|--------|
|
|
273
|
-
| User reports "there was a dump in production" | `dump --user <user> --date TODAY` |
|
|
274
|
-
| Any command returns HTTP 500 or unexpected error | `dump --date TODAY` (check for recent dumps) |
|
|
275
|
-
| `pull` or `inspect` fails with internal ABAP error | `dump --date TODAY` |
|
|
276
|
-
| Test run fails with runtime error | `dump --program <program> --date TODAY` |
|
|
277
|
-
| Investigating TIME_OUT or other specific error | `dump --error TIME_OUT` |
|
|
278
|
-
| Finding all errors from a specific user | `dump --user DEVELOPER` |
|
|
279
|
-
| Full error analysis with source location | `dump --detail 1` (after listing) |
|
|
280
|
-
|
|
281
|
-
#### Typical Investigation Workflow
|
|
270
|
+
**First reflex** for any HTTP 500, runtime error, or user-reported crash:
|
|
282
271
|
|
|
283
272
|
```bash
|
|
284
|
-
|
|
285
|
-
abapgit-agent dump
|
|
273
|
+
abapgit-agent dump --date TODAY # list today's dumps
|
|
274
|
+
abapgit-agent dump --date TODAY --detail 1 # full detail: call stack + source
|
|
275
|
+
```
|
|
286
276
|
|
|
287
|
-
|
|
288
|
-
|
|
277
|
+
The `--detail` output shows the exact failing line (`>>>>>` marker), call stack,
|
|
278
|
+
and SAP's error analysis. Use it before asking the user to open ST22.
|
|
289
279
|
|
|
290
|
-
|
|
291
|
-
|
|
280
|
+
Common filters:
|
|
281
|
+
```bash
|
|
282
|
+
abapgit-agent dump --user DEVELOPER --date TODAY # specific user
|
|
283
|
+
abapgit-agent dump --error TIME_OUT # specific error type
|
|
284
|
+
abapgit-agent dump --program ZMY_PROGRAM --detail 1 # specific program, full detail
|
|
292
285
|
```
|
|
293
286
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
-
|
|
297
|
-
|
|
298
|
-
|
|
287
|
+
After identifying the failing class/method, use `view` for broader context:
|
|
288
|
+
```bash
|
|
289
|
+
abapgit-agent view --objects ZCL_MY_CLASS
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### When There Is No Dump — Use `debug`
|
|
299
293
|
|
|
300
|
-
|
|
294
|
+
Use `debug` when:
|
|
295
|
+
- The bug is a logic error (wrong output, no crash)
|
|
296
|
+
- You need to inspect variable values mid-execution
|
|
297
|
+
- You want to verify which branch of code runs
|
|
301
298
|
|
|
299
|
+
**Step 1 — set a breakpoint** on the first executable statement you want to inspect:
|
|
300
|
+
```bash
|
|
301
|
+
abapgit-agent debug set --files src/zcl_my_class.clas.abap:42 # from local file
|
|
302
|
+
abapgit-agent debug set --objects ZCL_MY_CLASS:42 # by name (no local file needed)
|
|
303
|
+
abapgit-agent debug list # confirm it was registered
|
|
302
304
|
```
|
|
303
|
-
Short Dump Detail
|
|
304
305
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
Time 09:26:53
|
|
308
|
-
User DEVELOPER
|
|
309
|
-
Program ZMY_PROGRAM
|
|
306
|
+
> **Line number must point to an executable statement** — not a comment, blank line,
|
|
307
|
+
> `DATA` declaration, or `METHOD`/`ENDMETHOD`. Use `view --objects` to find valid lines.
|
|
310
308
|
|
|
311
|
-
|
|
312
|
-
-------------------------------------------------------
|
|
313
|
-
A RAISE statement raised the exception "MESSAGE_TYPE_X".
|
|
309
|
+
**Step 2 — attach and trigger**
|
|
314
310
|
|
|
315
|
-
|
|
316
|
-
-------------------------------------------------------
|
|
317
|
-
1 ZCL_MY_CLASS->DO_SOMETHING (line 42)
|
|
318
|
-
2 ZMY_PROGRAM START-OF-SELECTION (line 5)
|
|
311
|
+
Two modes depending on context:
|
|
319
312
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
313
|
+
*Interactive (human in a terminal):*
|
|
314
|
+
```bash
|
|
315
|
+
# Terminal 1 — attach (blocks waiting for breakpoint, opens REPL on hit)
|
|
316
|
+
abapgit-agent debug attach
|
|
317
|
+
|
|
318
|
+
# Terminal 2 — trigger (any command that calls the backend)
|
|
319
|
+
abapgit-agent unit --files src/zcl_my_class.clas.testclasses.abap
|
|
320
|
+
abapgit-agent inspect --files src/zcl_my_class.clas.abap
|
|
327
321
|
```
|
|
328
322
|
|
|
329
|
-
|
|
323
|
+
*Scripted (AI / automation) — best practice: individual sequential calls:*
|
|
324
|
+
|
|
325
|
+
Once the daemon is running and the session is saved to the state file, each
|
|
326
|
+
`vars/stack/step` command is a plain standalone call — no bash script needed.
|
|
330
327
|
|
|
331
328
|
```bash
|
|
332
|
-
#
|
|
333
|
-
abapgit-agent
|
|
334
|
-
|
|
329
|
+
# Step 1: start attach listener in background (spawns a daemon, saves session to state file)
|
|
330
|
+
abapgit-agent debug attach --json > /tmp/attach.json 2>&1 &
|
|
331
|
+
sleep 2
|
|
335
332
|
|
|
336
|
-
|
|
333
|
+
# Step 2: trigger in background — MUST stay alive for the whole session
|
|
334
|
+
abapgit-agent unit --files src/zcl_my_class.clas.testclasses.abap > /tmp/trigger.json 2>&1 &
|
|
337
335
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
336
|
+
# Step 3: poll until breakpoint fires and session JSON appears in attach output
|
|
337
|
+
SESSION=""
|
|
338
|
+
for i in $(seq 1 30); do
|
|
339
|
+
sleep 0.5
|
|
340
|
+
SESSION=$(grep -o '"session":"[^"]*"' /tmp/attach.json 2>/dev/null | head -1 | cut -d'"' -f4)
|
|
341
|
+
[ -n "$SESSION" ] && break
|
|
342
|
+
done
|
|
341
343
|
|
|
342
|
-
#
|
|
343
|
-
abapgit-agent
|
|
344
|
-
abapgit-agent
|
|
345
|
-
abapgit-agent
|
|
344
|
+
# Step 4: inspect and step — each is an individual call, no --session needed
|
|
345
|
+
abapgit-agent debug stack --json
|
|
346
|
+
abapgit-agent debug vars --json
|
|
347
|
+
abapgit-agent debug vars --expand LS_OBJECT --json
|
|
348
|
+
abapgit-agent debug step --type over --json
|
|
349
|
+
abapgit-agent debug vars --json
|
|
346
350
|
|
|
347
|
-
#
|
|
348
|
-
abapgit-agent
|
|
351
|
+
# Step 5: ALWAYS release the ABAP work process before finishing
|
|
352
|
+
abapgit-agent debug step --type continue --json
|
|
349
353
|
|
|
350
|
-
#
|
|
351
|
-
|
|
352
|
-
|
|
354
|
+
# Step 6: check trigger result
|
|
355
|
+
cat /tmp/trigger.json
|
|
356
|
+
rm -f /tmp/attach.json /tmp/trigger.json
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
> **Four rules for scripted mode:**
|
|
360
|
+
> 1. `sleep 2` after starting attach — the listener must register on the server before the trigger fires
|
|
361
|
+
> 2. Keep the trigger process alive in the background for the entire session — if it exits, the ABAP work process is released and the session ends
|
|
362
|
+
> 3. Always finish with `step --type continue` — this releases the frozen work process so the trigger can complete normally
|
|
363
|
+
> 4. **Never pass `--session` to `step/vars/stack`** — it bypasses the daemon IPC and causes `noSessionAttached`. Omit it and let commands auto-load from the saved state file.
|
|
353
364
|
|
|
354
|
-
|
|
355
|
-
abapgit-agent dump --user DEVELOPER --date TODAY --detail 1
|
|
365
|
+
**Step 3 — step through and inspect**
|
|
356
366
|
|
|
357
|
-
|
|
358
|
-
|
|
367
|
+
*Interactive REPL commands (after `attach` without `--json`):*
|
|
368
|
+
```
|
|
369
|
+
debug> v — show all variables
|
|
370
|
+
debug> x LT_DATA — expand a table or structure
|
|
371
|
+
debug> n — step over
|
|
372
|
+
debug> s — step into
|
|
373
|
+
debug> bt — call stack
|
|
374
|
+
debug> q — detach (program continues); kill — hard abort
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
*Scripted commands (after `attach --json`) — omit `--session`, commands auto-load from state file:*
|
|
378
|
+
```bash
|
|
379
|
+
abapgit-agent debug vars --json # all variables
|
|
380
|
+
abapgit-agent debug vars --name LV_RESULT --json # one variable
|
|
381
|
+
abapgit-agent debug vars --expand LT_DATA --json # drill into table/structure
|
|
382
|
+
abapgit-agent debug step --type over --json # step over
|
|
383
|
+
abapgit-agent debug step --type into --json # step into
|
|
384
|
+
abapgit-agent debug step --type continue --json # continue to next breakpoint / finish
|
|
385
|
+
abapgit-agent debug stack --json # call stack (shows which test method is active)
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
**Clean up** when done:
|
|
389
|
+
```bash
|
|
390
|
+
abapgit-agent debug delete --all
|
|
359
391
|
```
|
|
360
392
|
|
|
361
393
|
---
|
package/bin/abapgit-agent
CHANGED
|
@@ -51,6 +51,7 @@ async function main() {
|
|
|
51
51
|
preview: require('../src/commands/preview'),
|
|
52
52
|
where: require('../src/commands/where'),
|
|
53
53
|
dump: require('../src/commands/dump'),
|
|
54
|
+
debug: require('../src/commands/debug'),
|
|
54
55
|
ref: require('../src/commands/ref'),
|
|
55
56
|
init: require('../src/commands/init'),
|
|
56
57
|
pull: require('../src/commands/pull'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abapgit-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "ABAP Git Agent - Pull and activate ABAP code via abapGit from any git repository",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
"test:cmd:preview": "node tests/run-all.js --cmd --command=preview",
|
|
35
35
|
"test:cmd:tree": "node tests/run-all.js --cmd --command=tree",
|
|
36
36
|
"test:cmd:dump": "node tests/run-all.js --cmd --command=dump",
|
|
37
|
+
"test:cmd:debug": "node tests/run-all.js --cmd --command=debug",
|
|
38
|
+
"test:debug:scenarios": "bash tests/integration/debug-scenarios.sh",
|
|
39
|
+
"test:debug:scenarios:1": "bash tests/integration/debug-scenarios.sh 1",
|
|
40
|
+
"test:debug:scenarios:2": "bash tests/integration/debug-scenarios.sh 2",
|
|
41
|
+
"test:debug:scenarios:3": "bash tests/integration/debug-scenarios.sh 3",
|
|
37
42
|
"test:cmd:upgrade": "node tests/run-all.js --cmd --command=upgrade",
|
|
38
43
|
"test:lifecycle": "node tests/run-all.js --lifecycle",
|
|
39
44
|
"test:pull": "node tests/run-all.js --pull",
|