abapgit-agent 1.11.1 → 1.11.3
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/abap/.github/copilot-instructions.md +9 -9
- package/abap/CLAUDE.md +57 -538
- package/abap/guidelines/{08_abapgit.md → abapgit.md} +1 -1
- package/abap/guidelines/branch-workflow.md +137 -0
- package/abap/guidelines/cds-testing.md +25 -0
- package/abap/guidelines/{04_cds.md → cds.md} +4 -4
- package/abap/guidelines/{10_common_errors.md → common-errors.md} +3 -3
- package/abap/guidelines/debug-dump.md +33 -0
- package/abap/guidelines/debug-session.md +280 -0
- package/abap/guidelines/index.md +50 -0
- package/abap/guidelines/object-creation.md +51 -0
- package/abap/guidelines/{06_objects.md → objects.md} +5 -2
- package/abap/guidelines/{01_sql.md → sql.md} +2 -2
- package/abap/guidelines/{03_testing.md → testing.md} +3 -3
- package/abap/guidelines/workflow-detailed.md +255 -0
- package/package.json +1 -1
- package/src/commands/debug.js +54 -20
- package/src/commands/init.js +40 -0
- package/src/commands/inspect.js +5 -3
- package/src/commands/pull.js +4 -1
- package/src/commands/transport.js +3 -1
- package/src/commands/unit.js +10 -10
- package/src/commands/view.js +238 -1
- package/src/utils/abap-http.js +6 -1
- package/src/utils/abap-reference.js +4 -4
- package/src/utils/adt-http.js +6 -1
- package/src/utils/format-error.js +89 -0
- package/abap/guidelines/00_index.md +0 -44
- /package/abap/guidelines/{05_classes.md → classes.md} +0 -0
- /package/abap/guidelines/{02_exceptions.md → exceptions.md} +0 -0
- /package/abap/guidelines/{07_json.md → json.md} +0 -0
- /package/abap/guidelines/{09_unit_testable_code.md → unit-testable-code.md} +0 -0
package/abap/CLAUDE.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
layout: default
|
|
3
|
-
title:
|
|
3
|
+
title: Claude Code Instructions (Template)
|
|
4
4
|
nav_order: 1
|
|
5
5
|
parent: ABAP Development
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Claude Code Instructions - Template
|
|
9
9
|
|
|
10
10
|
This file provides guidelines for **generating ABAP code** in abapGit repositories.
|
|
11
11
|
|
|
@@ -54,7 +54,7 @@ abapgit-agent ref --topic sql
|
|
|
54
54
|
abapgit-agent ref --list-topics
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
### 2. Read `.abapGitAgent` for Folder Location
|
|
57
|
+
### 2. Read `.abapGitAgent` for Folder Location and Naming Conventions
|
|
58
58
|
|
|
59
59
|
**Before creating ANY ABAP object file, you MUST read `.abapGitAgent` to determine the correct folder.**
|
|
60
60
|
|
|
@@ -67,28 +67,21 @@ The folder is configured in `.abapGitAgent` (property: `folder`):
|
|
|
67
67
|
- If `folder` is `/src/` → files go in `src/` (e.g., `src/zcl_my_class.clas.abap`)
|
|
68
68
|
- If `folder` is `/abap/` → files go in `abap/` (e.g., `abap/zcl_my_class.clas.abap`)
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
### 3. Create XML Metadata for Each ABAP Object
|
|
70
|
+
**Also check naming conventions before creating any new object:**
|
|
73
71
|
|
|
74
|
-
|
|
72
|
+
```
|
|
73
|
+
1. Check guidelines/objects.local.md ← project-specific overrides (if file exists)
|
|
74
|
+
2. Fall back to guidelines/objects.md ← default Z/Y prefix conventions
|
|
75
|
+
```
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
|-------------|------------------------------|----------|---------|
|
|
78
|
-
| Class | `src/zcl_*.clas.abap` | `src/zcl_*.clas.xml` | See `guidelines/08_abapgit.md` |
|
|
79
|
-
| Interface | `src/zif_*.intf.abap` | `src/zif_*.intf.xml` | See `guidelines/08_abapgit.md` |
|
|
80
|
-
| Program | `src/z*.prog.abap` | `src/z*.prog.xml` | See `guidelines/08_abapgit.md` |
|
|
81
|
-
| Table | `src/z*.tabl.abap` | `src/z*.tabl.xml` | See `guidelines/08_abapgit.md` |
|
|
82
|
-
| **CDS View Entity** | `src/zc_*.ddls.asddls` | `src/zc_*.ddls.xml` | **Use by default** - See `guidelines/04_cds.md` |
|
|
83
|
-
| CDS View (legacy) | `src/zc_*.ddls.asddls` | `src/zc_*.ddls.xml` | Only if explicitly requested - See `guidelines/04_cds.md` |
|
|
77
|
+
`objects.local.md` is created by `abapgit-agent init` and is never overwritten by updates — it holds project-specific prefixes (e.g. `YCL_` instead of `ZCL_`).
|
|
84
78
|
|
|
85
|
-
|
|
79
|
+
---
|
|
86
80
|
|
|
87
|
-
|
|
81
|
+
### 3. Create XML Metadata / Local Classes
|
|
88
82
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- **XML templates**: `guidelines/08_abapgit.md`
|
|
83
|
+
Each ABAP object needs an XML metadata file. Local helper/test-double classes use separate `.locals_def.abap` / `.locals_imp.abap` files.
|
|
84
|
+
→ See `guidelines/object-creation.md` for XML templates and local class setup
|
|
92
85
|
|
|
93
86
|
---
|
|
94
87
|
|
|
@@ -138,24 +131,11 @@ abapgit-agent pull --files src/zif_my_intf.intf.abap,src/zcl_my_class.clas.abap
|
|
|
138
131
|
|
|
139
132
|
---
|
|
140
133
|
|
|
141
|
-
### 5. Local
|
|
134
|
+
### 5. Local Helper / Test-Double Classes
|
|
142
135
|
|
|
143
|
-
|
|
136
|
+
→ See `guidelines/object-creation.md` for local class setup (`locals_def.abap` / `locals_imp.abap`)
|
|
144
137
|
|
|
145
|
-
|
|
146
|
-
|------|---------|
|
|
147
|
-
| `zcl_xxx.clas.locals_def.abap` | Local class definitions |
|
|
148
|
-
| `zcl_xxx.clas.locals_imp.abap` | Local class implementations |
|
|
149
|
-
|
|
150
|
-
**XML Configuration**: Add `<CLSCCINCL>X</CLSCCINCL>` to the class XML to include local class definitions:
|
|
151
|
-
|
|
152
|
-
```xml
|
|
153
|
-
<VSEOCLASS>
|
|
154
|
-
<CLSNAME>ZCL_XXX</CLSNAME>
|
|
155
|
-
...
|
|
156
|
-
<CLSCCINCL>X</CLSCCINCL>
|
|
157
|
-
</VSEOCLASS>
|
|
158
|
-
```
|
|
138
|
+
---
|
|
159
139
|
|
|
160
140
|
### 6. Use `ref`, `view` and `where` Commands to Learn About Unknown Classes/Methods
|
|
161
141
|
|
|
@@ -219,21 +199,10 @@ AI thought process:
|
|
|
219
199
|
|
|
220
200
|
---
|
|
221
201
|
|
|
222
|
-
### 7.
|
|
202
|
+
### 7. CDS Unit Tests
|
|
223
203
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
```
|
|
227
|
-
❌ WRONG: Use regular AUnit test class without test doubles
|
|
228
|
-
✅ CORRECT: Use CL_CDS_TEST_ENVIRONMENT to create test doubles for CDS views
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
**Why**: CDS views read from database tables. Using test doubles allows:
|
|
232
|
-
- Injecting test data without affecting production data
|
|
233
|
-
- Testing specific scenarios that may not exist in production
|
|
234
|
-
- Fast, isolated tests that don't depend on database state
|
|
235
|
-
|
|
236
|
-
See `guidelines/03_testing.md` for code examples.
|
|
204
|
+
Use `CL_CDS_TEST_ENVIRONMENT` for unit tests that read CDS views.
|
|
205
|
+
→ See `guidelines/cds-testing.md` for code examples
|
|
237
206
|
|
|
238
207
|
---
|
|
239
208
|
|
|
@@ -258,120 +227,18 @@ abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.cla
|
|
|
258
227
|
|
|
259
228
|
### 9. Troubleshooting ABAP Issues
|
|
260
229
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
|
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 |
|
|
267
|
-
|
|
268
|
-
#### When Something Goes Wrong — Start with `dump`
|
|
269
|
-
|
|
270
|
-
**First reflex** for any HTTP 500, runtime error, or user-reported crash:
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
abapgit-agent dump --date TODAY # list today's dumps
|
|
274
|
-
abapgit-agent dump --date TODAY --detail 1 # full detail: call stack + source
|
|
275
|
-
```
|
|
276
|
-
|
|
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.
|
|
279
|
-
|
|
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
|
|
285
|
-
```
|
|
286
|
-
|
|
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`
|
|
293
|
-
|
|
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
|
|
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
|
|
304
|
-
```
|
|
305
|
-
|
|
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.
|
|
308
|
-
|
|
309
|
-
**Step 2 — attach and trigger**
|
|
310
|
-
|
|
311
|
-
Best practice: individual sequential calls. Once the daemon is running and
|
|
312
|
-
the session is saved to the state file, each `vars/stack/step` command is a
|
|
313
|
-
plain standalone call — no `--session` flag needed.
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
# Start attach listener in background (spawns a daemon, saves session to state file)
|
|
317
|
-
abapgit-agent debug attach --json > /tmp/attach.json 2>&1 &
|
|
318
|
-
|
|
319
|
-
# Rule 1: wait for "Listener active" in the output, THEN fire the trigger.
|
|
320
|
-
# attach --json prints "Listener active" to stderr (captured in attach.json) the
|
|
321
|
-
# moment the long-poll POST is about to be sent to ADT. Waiting for this marker
|
|
322
|
-
# is reliable under any system load; a blind sleep may fire the trigger before
|
|
323
|
-
# ADT has a registered listener, causing the breakpoint hit to be missed.
|
|
324
|
-
until grep -q "Listener active" /tmp/attach.json 2>/dev/null; do sleep 0.3; done
|
|
325
|
-
sleep 1 # brief extra window for the POST to reach ADT
|
|
326
|
-
|
|
327
|
-
# Trigger in background — MUST stay alive for the whole session
|
|
328
|
-
abapgit-agent unit --files src/zcl_my_class.clas.testclasses.abap > /tmp/trigger.json 2>&1 &
|
|
329
|
-
|
|
330
|
-
# Poll until breakpoint fires and session JSON appears in attach output
|
|
331
|
-
SESSION=""
|
|
332
|
-
for i in $(seq 1 30); do
|
|
333
|
-
sleep 0.5
|
|
334
|
-
SESSION=$(grep -o '"session":"[^"]*"' /tmp/attach.json 2>/dev/null | head -1 | cut -d'"' -f4)
|
|
335
|
-
[ -n "$SESSION" ] && break
|
|
336
|
-
done
|
|
337
|
-
|
|
338
|
-
# Inspect and step — each is an individual call, no --session needed
|
|
339
|
-
abapgit-agent debug stack --json
|
|
340
|
-
abapgit-agent debug vars --json
|
|
341
|
-
abapgit-agent debug vars --expand LS_OBJECT --json
|
|
342
|
-
abapgit-agent debug step --type over --json
|
|
343
|
-
abapgit-agent debug vars --json
|
|
344
|
-
|
|
345
|
-
# ALWAYS release the ABAP work process before finishing
|
|
346
|
-
abapgit-agent debug step --type continue --json
|
|
347
|
-
|
|
348
|
-
# Check trigger result
|
|
349
|
-
cat /tmp/trigger.json
|
|
350
|
-
rm -f /tmp/attach.json /tmp/trigger.json
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
> **Four rules for scripted mode:**
|
|
354
|
-
> 1. Wait for `"Listener active"` in the attach output before firing the trigger — this message is printed to stderr (captured in `attach.json`) the moment the listener POST is about to reach ADT. A blind `sleep` is not reliable under system load.
|
|
355
|
-
> 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
|
|
356
|
-
> 3. Always finish with `step --type continue` — this releases the frozen work process so the trigger can complete normally
|
|
357
|
-
> 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.
|
|
358
|
-
|
|
359
|
-
**Step 3 — step through and inspect**
|
|
230
|
+
| Symptom | Tool | When |
|
|
231
|
+
|---|---|---|
|
|
232
|
+
| HTTP 500 / runtime crash (ST22) | `dump` | Error already occurred |
|
|
233
|
+
| Wrong output, no crash | `debug` | Need to trace logic |
|
|
360
234
|
|
|
235
|
+
Quick start:
|
|
361
236
|
```bash
|
|
362
|
-
abapgit-agent
|
|
363
|
-
abapgit-agent debug
|
|
364
|
-
abapgit-agent debug vars --expand LT_DATA --json # drill into table/structure
|
|
365
|
-
abapgit-agent debug step --type over --json # step over
|
|
366
|
-
abapgit-agent debug step --type into --json # step into
|
|
367
|
-
abapgit-agent debug step --type continue --json # continue to next breakpoint / finish
|
|
368
|
-
abapgit-agent debug stack --json # call stack (shows which test method is active)
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
**Clean up** when done:
|
|
372
|
-
```bash
|
|
373
|
-
abapgit-agent debug delete --all
|
|
237
|
+
abapgit-agent dump --date TODAY --detail 1 # inspect last crash
|
|
238
|
+
abapgit-agent debug set --objects ZCL_FOO:42 # set breakpoint then attach
|
|
374
239
|
```
|
|
240
|
+
→ See `guidelines/debug-dump.md` for dump analysis workflow
|
|
241
|
+
→ See `guidelines/debug-session.md` for full debug session guide, breakpoint tips, and pull flow architecture
|
|
375
242
|
|
|
376
243
|
---
|
|
377
244
|
|
|
@@ -409,135 +276,8 @@ See **AI Tool Guidelines** below for how to react to each setting.
|
|
|
409
276
|
|
|
410
277
|
### Branch Workflow (`"mode": "branch"`)
|
|
411
278
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
#### Starting a New Feature
|
|
415
|
-
|
|
416
|
-
```bash
|
|
417
|
-
# 1. Create and switch to feature branch from default branch
|
|
418
|
-
git checkout main # or master/develop (auto-detected)
|
|
419
|
-
git pull origin main
|
|
420
|
-
git checkout -b feature/user-authentication
|
|
421
|
-
|
|
422
|
-
# 2. Make your changes
|
|
423
|
-
edit src/zcl_auth_handler.clas.abap
|
|
424
|
-
|
|
425
|
-
# 3. Check syntax (CLAS/INTF/PROG/DDLS only, if independent)
|
|
426
|
-
abapgit-agent syntax --files src/zcl_auth_handler.clas.abap
|
|
427
|
-
|
|
428
|
-
# 4. Commit
|
|
429
|
-
git add src/zcl_auth_handler.clas.abap
|
|
430
|
-
git commit -m "feat: add authentication handler"
|
|
431
|
-
|
|
432
|
-
# 5. Push feature branch
|
|
433
|
-
git push origin feature/user-authentication
|
|
434
|
-
|
|
435
|
-
# 6. **CRITICAL**: Rebase before pull
|
|
436
|
-
git fetch origin main
|
|
437
|
-
git rebase origin/main
|
|
438
|
-
git push origin feature/user-authentication --force-with-lease
|
|
439
|
-
|
|
440
|
-
# 7. Pull to ABAP system
|
|
441
|
-
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
#### During Development: Always Rebase Before Pull
|
|
445
|
-
|
|
446
|
-
**CRITICAL**: Before every `pull` command, rebase to default branch to avoid activating outdated code.
|
|
447
|
-
|
|
448
|
-
```bash
|
|
449
|
-
# Before EVERY pull, always do this:
|
|
450
|
-
git fetch origin main # main/master/develop (auto-detected)
|
|
451
|
-
git rebase origin/main
|
|
452
|
-
|
|
453
|
-
# If no conflicts:
|
|
454
|
-
git push origin feature/user-authentication --force-with-lease
|
|
455
|
-
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
456
|
-
|
|
457
|
-
# If conflicts:
|
|
458
|
-
# 1. Fix conflicts in files
|
|
459
|
-
# 2. git add <resolved-files>
|
|
460
|
-
# 3. git rebase --continue
|
|
461
|
-
# 4. git push origin feature/user-authentication --force-with-lease
|
|
462
|
-
# 5. abapgit-agent pull --files ...
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
#### Completing the Feature
|
|
466
|
-
|
|
467
|
-
```bash
|
|
468
|
-
# 1. Final rebase and push
|
|
469
|
-
git fetch origin main
|
|
470
|
-
git rebase origin/main
|
|
471
|
-
git push origin feature/user-authentication --force-with-lease
|
|
472
|
-
|
|
473
|
-
# 2. Final activation and test
|
|
474
|
-
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
475
|
-
abapgit-agent unit --files src/zcl_auth_handler.clas.testclasses.abap
|
|
476
|
-
|
|
477
|
-
# 3. Create PR (squash merge enabled on GitHub/GitLab)
|
|
478
|
-
# Go to GitHub and create PR from feature/user-authentication to main
|
|
479
|
-
# Select "Squash and merge" option to combine all commits into one
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
#### Why Rebase Before Pull?
|
|
483
|
-
|
|
484
|
-
ABAP is a **centralized system**. Multiple developers may modify the same files:
|
|
485
|
-
|
|
486
|
-
| Without Rebase | With Rebase |
|
|
487
|
-
|----------------|-------------|
|
|
488
|
-
| ✗ Your branch is based on old main | ✓ Your branch includes latest changes |
|
|
489
|
-
| ✗ Activate outdated code in ABAP | ✓ Activate current code |
|
|
490
|
-
| ✗ May overwrite others' work | ✓ Conflicts caught before activation |
|
|
491
|
-
| ✗ Hard to debug issues | ✓ Clear what changed |
|
|
492
|
-
|
|
493
|
-
**Example Scenario:**
|
|
494
|
-
|
|
495
|
-
```
|
|
496
|
-
Situation:
|
|
497
|
-
- You: working on feature/auth (based on main commit A)
|
|
498
|
-
- Colleague: pushed to main (now at commit B)
|
|
499
|
-
- Both modified: src/zcl_auth_handler.clas.abap
|
|
500
|
-
|
|
501
|
-
Without rebase:
|
|
502
|
-
feature/auth pull → activates version from commit A ✗
|
|
503
|
-
|
|
504
|
-
With rebase:
|
|
505
|
-
git rebase origin/main → either:
|
|
506
|
-
- No conflict: includes colleague's changes ✓
|
|
507
|
-
- Conflict: you see it and resolve ✓
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
#### Complete Example Workflow (Branch Mode)
|
|
511
|
-
|
|
512
|
-
```bash
|
|
513
|
-
# Day 1: Start feature
|
|
514
|
-
git checkout main && git pull origin main
|
|
515
|
-
git checkout -b feature/user-authentication
|
|
516
|
-
edit src/zcl_auth_handler.clas.abap
|
|
517
|
-
abapgit-agent syntax --files src/zcl_auth_handler.clas.abap
|
|
518
|
-
git add . && git commit -m "wip: add basic auth logic"
|
|
519
|
-
git push origin feature/user-authentication
|
|
520
|
-
git fetch origin main && git rebase origin/main
|
|
521
|
-
git push origin feature/user-authentication --force-with-lease
|
|
522
|
-
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
523
|
-
|
|
524
|
-
# Day 2: Continue (colleague pushed to main overnight)
|
|
525
|
-
git fetch origin main && git rebase origin/main
|
|
526
|
-
# If conflicts: resolve, git add, git rebase --continue
|
|
527
|
-
git push origin feature/user-authentication --force-with-lease
|
|
528
|
-
edit src/zcl_auth_handler.clas.abap
|
|
529
|
-
git add . && git commit -m "feat: complete auth logic"
|
|
530
|
-
git push origin feature/user-authentication
|
|
531
|
-
git fetch origin main && git rebase origin/main
|
|
532
|
-
git push origin feature/user-authentication --force-with-lease
|
|
533
|
-
abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
534
|
-
|
|
535
|
-
# Day 3: Finish feature
|
|
536
|
-
abapgit-agent unit --files src/zcl_auth_handler.clas.testclasses.abap
|
|
537
|
-
git fetch origin main && git rebase origin/main
|
|
538
|
-
git push origin feature/user-authentication --force-with-lease
|
|
539
|
-
# Create PR on GitHub/GitLab (squash 3 commits into 1)
|
|
540
|
-
```
|
|
279
|
+
Always work on feature branches. Before every `pull`: rebase to default branch. On completion: create PR with squash merge.
|
|
280
|
+
→ See `guidelines/branch-workflow.md` for step-by-step commands and examples
|
|
541
281
|
|
|
542
282
|
### Trunk Workflow (`"mode": "trunk"`)
|
|
543
283
|
|
|
@@ -605,253 +345,22 @@ abapgit-agent pull --files src/zcl_auth_handler.clas.abap
|
|
|
605
345
|
|
|
606
346
|
---
|
|
607
347
|
|
|
608
|
-
## Development Workflow (Detailed)
|
|
609
|
-
|
|
610
|
-
```
|
|
611
|
-
1. Read .abapGitAgent → get folder value AND workflow.mode
|
|
612
|
-
│
|
|
613
|
-
▼
|
|
614
|
-
2. Research → use ref command for unfamiliar topics
|
|
615
|
-
│
|
|
616
|
-
▼
|
|
617
|
-
3. Write code → place in correct folder (e.g., src/zcl_*.clas.abap)
|
|
618
|
-
│
|
|
619
|
-
▼
|
|
620
|
-
4. Syntax check (for CLAS, INTF, PROG, DDLS only)
|
|
621
|
-
│
|
|
622
|
-
├─► CLAS/INTF/PROG/DDLS → abapgit-agent syntax --files <file>
|
|
623
|
-
│ │
|
|
624
|
-
│ ├─► Errors? → Fix locally (no commit needed), re-run syntax
|
|
625
|
-
│ │
|
|
626
|
-
│ └─► Clean ✅ → Proceed to commit
|
|
627
|
-
│
|
|
628
|
-
└─► Other types (FUGR, TABL, etc.) → Skip syntax, go to commit
|
|
629
|
-
│
|
|
630
|
-
▼
|
|
631
|
-
5. Commit and push → git add . && git commit && git push
|
|
632
|
-
│
|
|
633
|
-
▼
|
|
634
|
-
6. Activate → abapgit-agent pull --files src/file.clas.abap
|
|
635
|
-
│ (behaviour depends on .abapgit-agent.json — see AI Tool Guidelines)
|
|
636
|
-
│
|
|
637
|
-
▼
|
|
638
|
-
7. Verify → Check pull output
|
|
639
|
-
- **"Error updating where-used list"** → SYNTAX ERROR (use inspect for details)
|
|
640
|
-
- Objects in "Failed Objects Log" → Syntax error (use inspect)
|
|
641
|
-
- Objects NOT appearing at all → XML metadata issue (check 08_abapgit.md)
|
|
642
|
-
│
|
|
643
|
-
▼
|
|
644
|
-
8. (Optional) Run unit tests → abapgit-agent unit --files <testclass> (AFTER successful pull)
|
|
645
|
-
```
|
|
646
|
-
|
|
647
|
-
**Syntax Command - Supported Object Types:**
|
|
648
|
-
|
|
649
|
-
| Object Type | Syntax Command | What to Do |
|
|
650
|
-
|-------------|----------------|------------|
|
|
651
|
-
| CLAS (classes) | ✅ Supported | Run `syntax` before commit |
|
|
652
|
-
| CLAS (test classes: .testclasses.abap) | ✅ Supported | Run `syntax` before commit |
|
|
653
|
-
| INTF (interfaces) | ✅ Supported | Run `syntax` before commit |
|
|
654
|
-
| PROG (programs) | ✅ Supported | Run `syntax` before commit |
|
|
655
|
-
| DDLS (CDS views) | ✅ Supported | Run `syntax` before commit (requires annotations) |
|
|
656
|
-
| FUGR (function groups) | ❌ Not supported | Skip syntax, use `pull` then `inspect` |
|
|
657
|
-
| TABL/DTEL/DOMA/MSAG/SHLP | ❌ Not supported | Skip syntax, just `pull` |
|
|
658
|
-
| All other types | ❌ Not supported | Skip syntax, just `pull` |
|
|
659
|
-
|
|
660
|
-
**IMPORTANT**:
|
|
661
|
-
- **Use `syntax` BEFORE commit** for CLAS/INTF/PROG/DDLS - catches errors early, no git pollution
|
|
662
|
-
- **Syntax checks files INDEPENDENTLY** - syntax checker doesn't have access to uncommitted files
|
|
663
|
-
- **For dependent files** (interface + class): Create/activate underlying object FIRST, then dependent object (see workflow below)
|
|
664
|
-
- **DDLS requires proper annotations** - CDS views need `@AbapCatalog.sqlViewName`, view entities don't
|
|
665
|
-
- **ALWAYS push to git BEFORE running pull** - abapGit reads from git
|
|
666
|
-
- **Use `inspect` AFTER pull** for unsupported types or if pull fails
|
|
667
|
-
|
|
668
|
-
**Working with dependent objects (RECOMMENDED APPROACH):**
|
|
669
|
-
|
|
670
|
-
When creating objects with dependencies (e.g., interface → class), create and activate the underlying object FIRST:
|
|
671
|
-
|
|
672
|
-
```bash
|
|
673
|
-
# Step 1: Create interface, syntax check, commit, activate
|
|
674
|
-
vim src/zif_my_interface.intf.abap
|
|
675
|
-
abapgit-agent syntax --files src/zif_my_interface.intf.abap # ✅ Works (no dependencies)
|
|
676
|
-
git add src/zif_my_interface.intf.abap src/zif_my_interface.intf.xml
|
|
677
|
-
git commit -m "feat: add interface"
|
|
678
|
-
git push
|
|
679
|
-
abapgit-agent pull --files src/zif_my_interface.intf.abap # Interface now activated
|
|
680
|
-
|
|
681
|
-
# Step 2: Create class, syntax check, commit, activate
|
|
682
|
-
vim src/zcl_my_class.clas.abap
|
|
683
|
-
abapgit-agent syntax --files src/zcl_my_class.clas.abap # ✅ Works (interface already activated)
|
|
684
|
-
git add src/zcl_my_class.clas.abap src/zcl_my_class.clas.xml
|
|
685
|
-
git commit -m "feat: add class implementing interface"
|
|
686
|
-
git push
|
|
687
|
-
abapgit-agent pull --files src/zcl_my_class.clas.abap
|
|
688
|
-
```
|
|
689
|
-
|
|
690
|
-
**Benefits:**
|
|
691
|
-
- ✅ Syntax checking works for both objects
|
|
692
|
-
- ✅ Each step is validated independently
|
|
693
|
-
- ✅ Easier to debug if something fails
|
|
694
|
-
- ✅ Cleaner workflow
|
|
695
|
-
|
|
696
|
-
**Alternative approach (when interface design is uncertain):**
|
|
697
|
-
|
|
698
|
-
If the interface might need changes while implementing the class, commit both together:
|
|
699
|
-
|
|
700
|
-
```bash
|
|
701
|
-
# Create both files
|
|
702
|
-
vim src/zif_my_interface.intf.abap
|
|
703
|
-
vim src/zcl_my_class.clas.abap
|
|
704
|
-
|
|
705
|
-
# Skip syntax (files depend on each other), commit together
|
|
706
|
-
git add src/zif_my_interface.intf.abap src/zif_my_interface.intf.xml
|
|
707
|
-
git add src/zcl_my_class.clas.abap src/zcl_my_class.clas.xml
|
|
708
|
-
git commit -m "feat: add interface and implementing class"
|
|
709
|
-
git push
|
|
710
|
-
|
|
711
|
-
# Pull both together
|
|
712
|
-
abapgit-agent pull --files src/zif_my_interface.intf.abap,src/zcl_my_class.clas.abap
|
|
713
|
-
|
|
714
|
-
# Use inspect if errors occur
|
|
715
|
-
abapgit-agent inspect --files src/zcl_my_class.clas.abap
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
**Use this approach when:**
|
|
719
|
-
- ❌ Interface design is still evolving
|
|
720
|
-
- ❌ Multiple iterations expected
|
|
721
|
-
|
|
722
|
-
**Working with mixed file types:**
|
|
723
|
-
When modifying multiple files of different types (e.g., 1 class + 1 CDS view):
|
|
724
|
-
1. Run `syntax` on independent supported files (CLAS, INTF, PROG, DDLS)
|
|
725
|
-
2. Commit ALL files together (including unsupported types)
|
|
726
|
-
3. Push and pull ALL files together
|
|
727
|
-
|
|
728
|
-
Example:
|
|
729
|
-
```bash
|
|
730
|
-
# Check syntax on independent files only
|
|
731
|
-
abapgit-agent syntax --files src/zcl_my_class.clas.abap,src/zc_my_view.ddls.asddls
|
|
732
|
-
|
|
733
|
-
# Commit and push all files
|
|
734
|
-
git add src/zcl_my_class.clas.abap src/zc_my_view.ddls.asddls
|
|
735
|
-
git commit -m "feat: add class and CDS view"
|
|
736
|
-
git push
|
|
737
|
-
|
|
738
|
-
# Pull all files together
|
|
739
|
-
abapgit-agent pull --files src/zcl_my_class.clas.abap,src/zc_my_view.ddls.asddls
|
|
740
|
-
```
|
|
741
|
-
|
|
742
|
-
**When to use syntax vs inspect vs view**:
|
|
743
|
-
- **syntax**: Check LOCAL code BEFORE commit (CLAS, INTF, PROG, DDLS)
|
|
744
|
-
- **inspect**: Check ACTIVATED code AFTER pull (all types, runs Code Inspector)
|
|
745
|
-
- **view**: Understand object STRUCTURE (not for debugging errors)
|
|
746
|
-
|
|
747
348
|
### Quick Decision Tree for AI
|
|
748
349
|
|
|
749
350
|
**When user asks to modify/create ABAP code:**
|
|
750
351
|
|
|
751
352
|
```
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
├─ Interface + implementing class? → DEPENDENT (interface is underlying)
|
|
761
|
-
├─ Class A uses class B? → DEPENDENT (class B is underlying)
|
|
762
|
-
├─ CDS view uses table? → INDEPENDENT (table already exists)
|
|
763
|
-
└─ Unrelated bug fixes across files? → INDEPENDENT
|
|
764
|
-
|
|
765
|
-
3. For SUPPORTED types (CLAS/INTF/PROG/DDLS):
|
|
766
|
-
├─ INDEPENDENT files → Run syntax → Fix errors → Commit → Push → Pull
|
|
767
|
-
│
|
|
768
|
-
└─ DEPENDENT files (NEW objects):
|
|
769
|
-
├─ RECOMMENDED: Create underlying object first (interface, base class, etc.)
|
|
770
|
-
│ 1. Create underlying object → Syntax → Commit → Push → Pull
|
|
771
|
-
│ 2. Create dependent object → Syntax (works!) → Commit → Push → Pull
|
|
772
|
-
│ ✅ Benefits: Both syntax checks work, cleaner workflow
|
|
773
|
-
│
|
|
774
|
-
└─ ALTERNATIVE: If interface design uncertain, commit both together
|
|
775
|
-
→ Skip syntax → Commit both → Push → Pull → (if errors: inspect)
|
|
776
|
-
|
|
777
|
-
4. For UNSUPPORTED types (FUGR, TABL, etc.):
|
|
778
|
-
Write code → Skip syntax → Commit → Push → Pull → (if errors: inspect)
|
|
779
|
-
|
|
780
|
-
5. For MIXED types (some supported + some unsupported):
|
|
781
|
-
Write all code → Run syntax on independent supported files ONLY → Commit ALL → Push → Pull ALL
|
|
353
|
+
Modified ABAP files?
|
|
354
|
+
├─ CLAS/INTF/PROG/DDLS files?
|
|
355
|
+
│ ├─ Independent files (no cross-dependencies)?
|
|
356
|
+
│ │ └─ ✅ Use: syntax → commit → push → pull
|
|
357
|
+
│ └─ Dependent files (interface + class, class uses class)?
|
|
358
|
+
│ └─ ✅ Use: skip syntax → commit → push → pull
|
|
359
|
+
└─ Other types (DDLS, FUGR, TABL, etc.)?
|
|
360
|
+
└─ ✅ Use: skip syntax → commit → push → pull → (if errors: inspect)
|
|
782
361
|
```
|
|
783
362
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
**Scenario 1: Interface + Class (RECOMMENDED)**
|
|
787
|
-
```bash
|
|
788
|
-
# Step 1: Interface first
|
|
789
|
-
vim src/zif_calculator.intf.abap
|
|
790
|
-
abapgit-agent syntax --files src/zif_calculator.intf.abap # ✅ Works
|
|
791
|
-
git commit -am "feat: add calculator interface" && git push
|
|
792
|
-
abapgit-agent pull --files src/zif_calculator.intf.abap # Interface activated
|
|
793
|
-
|
|
794
|
-
# Step 2: Class next
|
|
795
|
-
vim src/zcl_calculator.clas.abap
|
|
796
|
-
abapgit-agent syntax --files src/zcl_calculator.clas.abap # ✅ Works (interface exists!)
|
|
797
|
-
git commit -am "feat: implement calculator" && git push
|
|
798
|
-
abapgit-agent pull --files src/zcl_calculator.clas.abap
|
|
799
|
-
```
|
|
800
|
-
|
|
801
|
-
**Scenario 2: Multiple independent classes**
|
|
802
|
-
```bash
|
|
803
|
-
# All syntax checks work (no dependencies)
|
|
804
|
-
vim src/zcl_class1.clas.abap src/zcl_class2.clas.abap
|
|
805
|
-
abapgit-agent syntax --files src/zcl_class1.clas.abap,src/zcl_class2.clas.abap
|
|
806
|
-
git commit -am "feat: add utility classes" && git push
|
|
807
|
-
abapgit-agent pull --files src/zcl_class1.clas.abap,src/zcl_class2.clas.abap
|
|
808
|
-
```
|
|
809
|
-
|
|
810
|
-
**Error indicators after pull:**
|
|
811
|
-
- ❌ **"Error updating where-used list"** → SYNTAX ERROR - run `inspect` for details
|
|
812
|
-
- ❌ **Objects in "Failed Objects Log"** → SYNTAX ERROR - run `inspect`
|
|
813
|
-
- ❌ **Objects NOT appearing at all** → XML metadata issue (check `ref --topic abapgit`)
|
|
814
|
-
- ⚠️ **"Activated with warnings"** → Code Inspector warnings - run `inspect` to see details
|
|
815
|
-
|
|
816
|
-
### Commands
|
|
817
|
-
|
|
818
|
-
```bash
|
|
819
|
-
# 1. Syntax check LOCAL code BEFORE commit (CLAS, INTF, PROG, DDLS)
|
|
820
|
-
abapgit-agent syntax --files src/zcl_my_class.clas.abap
|
|
821
|
-
abapgit-agent syntax --files src/zc_my_view.ddls.asddls
|
|
822
|
-
abapgit-agent syntax --files src/zcl_class1.clas.abap,src/zif_intf1.intf.abap,src/zc_view.ddls.asddls
|
|
823
|
-
|
|
824
|
-
# 2. Pull/activate AFTER pushing to git
|
|
825
|
-
abapgit-agent pull --files src/zcl_class1.clas.abap,src/zcl_class2.clas.abap
|
|
826
|
-
|
|
827
|
-
# Override conflict detection for a single pull (e.g. deliberate branch switch)
|
|
828
|
-
abapgit-agent pull --files src/zcl_class1.clas.abap --conflict-mode ignore
|
|
829
|
-
|
|
830
|
-
# 3. Inspect AFTER pull (for errors or unsupported types)
|
|
831
|
-
abapgit-agent inspect --files src/zcl_class1.clas.abap
|
|
832
|
-
|
|
833
|
-
# Run unit tests (after successful pull)
|
|
834
|
-
abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.clas.testclasses.abap
|
|
835
|
-
|
|
836
|
-
# View object definitions (multiple objects)
|
|
837
|
-
abapgit-agent view --objects ZCL_CLASS1,ZCL_CLASS2,ZIF_INTERFACE
|
|
838
|
-
|
|
839
|
-
# Preview table data (multiple tables/views)
|
|
840
|
-
abapgit-agent preview --objects ZTABLE1,ZTABLE2
|
|
841
|
-
|
|
842
|
-
# Explore table structures
|
|
843
|
-
abapgit-agent view --objects ZTABLE --type TABL
|
|
844
|
-
|
|
845
|
-
# Display package tree
|
|
846
|
-
abapgit-agent tree --package \$MY_PACKAGE
|
|
847
|
-
|
|
848
|
-
# Investigate runtime errors (ST22 short dumps)
|
|
849
|
-
abapgit-agent dump # Last 7 days
|
|
850
|
-
abapgit-agent dump --user DEVELOPER --date TODAY # Today's dumps for a user
|
|
851
|
-
abapgit-agent dump --program ZMY_PROGRAM # Dumps from a specific program
|
|
852
|
-
abapgit-agent dump --error TIME_OUT # Dumps by error type
|
|
853
|
-
abapgit-agent dump --user DEVELOPER --detail 1 # Full detail of first result
|
|
854
|
-
```
|
|
363
|
+
→ See `guidelines/workflow-detailed.md` for full workflow decision tree, error indicators, and complete command reference
|
|
855
364
|
|
|
856
365
|
---
|
|
857
366
|
|
|
@@ -861,14 +370,24 @@ Detailed guidelines are available in the `guidelines/` folder:
|
|
|
861
370
|
|
|
862
371
|
| File | Topic |
|
|
863
372
|
|------|-------|
|
|
864
|
-
| `guidelines/
|
|
865
|
-
| `guidelines/
|
|
866
|
-
| `guidelines/
|
|
867
|
-
| `guidelines/
|
|
868
|
-
| `guidelines/
|
|
869
|
-
| `guidelines/
|
|
870
|
-
| `guidelines/
|
|
871
|
-
| `guidelines/
|
|
373
|
+
| `guidelines/index.md` | Overview and usage |
|
|
374
|
+
| `guidelines/sql.md` | ABAP SQL Best Practices |
|
|
375
|
+
| `guidelines/exceptions.md` | Exception Handling |
|
|
376
|
+
| `guidelines/testing.md` | Unit Testing (including CDS) |
|
|
377
|
+
| `guidelines/cds.md` | CDS Views |
|
|
378
|
+
| `guidelines/classes.md` | ABAP Classes and Objects |
|
|
379
|
+
| `guidelines/objects.md` | Object Naming Conventions (defaults) |
|
|
380
|
+
| `guidelines/objects.local.md` | **Project** Naming Conventions — overrides `objects.md` (created by `init`, never overwritten) |
|
|
381
|
+
| `guidelines/json.md` | JSON Handling |
|
|
382
|
+
| `guidelines/abapgit.md` | abapGit XML Metadata Templates |
|
|
383
|
+
| `guidelines/unit-testable-code.md` | Unit Testable Code Guidelines (Dependency Injection) |
|
|
384
|
+
| `guidelines/common-errors.md` | Common ABAP Errors - Quick Fixes |
|
|
385
|
+
| `guidelines/debug-session.md` | Debug Session Guide |
|
|
386
|
+
| `guidelines/debug-dump.md` | Dump Analysis Guide |
|
|
387
|
+
| `guidelines/branch-workflow.md` | Branch Workflow |
|
|
388
|
+
| `guidelines/workflow-detailed.md` | Development Workflow (Detailed) |
|
|
389
|
+
| `guidelines/object-creation.md` | Object Creation (XML metadata, local classes) |
|
|
390
|
+
| `guidelines/cds-testing.md` | CDS Testing (Test Double Framework) |
|
|
872
391
|
|
|
873
392
|
These guidelines are automatically searched by the `ref` command.
|
|
874
393
|
|
|
@@ -237,7 +237,7 @@ abapGit needs XML files to:
|
|
|
237
237
|
5. **Serializer**: Use `LCL_OBJECT_DDLS`
|
|
238
238
|
6. **Source file**: Must include `@AbapCatalog.sqlViewName` annotation
|
|
239
239
|
|
|
240
|
-
**For detailed comparison and usage guidance, see `guidelines/
|
|
240
|
+
**For detailed comparison and usage guidance, see `guidelines/cds.md`**
|
|
241
241
|
|
|
242
242
|
---
|
|
243
243
|
|