abapgit-agent 1.7.2 → 1.8.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.
Files changed (39) hide show
  1. package/README.md +7 -7
  2. package/abap/CLAUDE.md +145 -26
  3. package/abap/guidelines/00_index.md +8 -0
  4. package/abap/guidelines/01_sql.md +8 -0
  5. package/abap/guidelines/02_exceptions.md +8 -0
  6. package/abap/guidelines/03_testing.md +8 -0
  7. package/abap/guidelines/04_cds.md +8 -0
  8. package/abap/guidelines/05_classes.md +8 -0
  9. package/abap/guidelines/06_objects.md +8 -0
  10. package/abap/guidelines/07_json.md +8 -0
  11. package/abap/guidelines/08_abapgit.md +8 -0
  12. package/abap/guidelines/09_unit_testable_code.md +8 -0
  13. package/bin/abapgit-agent +61 -2852
  14. package/package.json +21 -5
  15. package/src/agent.js +205 -16
  16. package/src/commands/create.js +102 -0
  17. package/src/commands/delete.js +72 -0
  18. package/src/commands/health.js +24 -0
  19. package/src/commands/help.js +111 -0
  20. package/src/commands/import.js +99 -0
  21. package/src/commands/init.js +321 -0
  22. package/src/commands/inspect.js +184 -0
  23. package/src/commands/list.js +143 -0
  24. package/src/commands/preview.js +277 -0
  25. package/src/commands/pull.js +278 -0
  26. package/src/commands/ref.js +96 -0
  27. package/src/commands/status.js +52 -0
  28. package/src/commands/syntax.js +290 -0
  29. package/src/commands/tree.js +209 -0
  30. package/src/commands/unit.js +133 -0
  31. package/src/commands/view.js +215 -0
  32. package/src/commands/where.js +138 -0
  33. package/src/config.js +11 -1
  34. package/src/utils/abap-http.js +347 -0
  35. package/src/utils/git-utils.js +58 -0
  36. package/src/utils/validators.js +72 -0
  37. package/src/utils/version-check.js +80 -0
  38. package/src/abap-client.js +0 -526
  39. /package/src/{ref-search.js → utils/abap-reference.js} +0 -0
package/README.md CHANGED
@@ -25,7 +25,7 @@ git clone https://github.com/user/abap-project.git
25
25
  cd abap-project
26
26
 
27
27
  # 3. Initialize configuration
28
- abapgit-agent init --folder /abap/ --package ZMY_PACKAGE
28
+ abapgit-agent init --folder /src/ --package ZMY_PACKAGE
29
29
 
30
30
  # 4. Edit .abapGitAgent with credentials
31
31
 
@@ -47,7 +47,7 @@ See [Creating New ABAP Projects](INSTALL.md#creating-new-abap-projects) to set u
47
47
 
48
48
  ```bash
49
49
  # Initialize local configuration for existing git repo
50
- abapgit-agent init --folder /abap/ --package ZMY_PACKAGE
50
+ abapgit-agent init --folder /src/ --package ZMY_PACKAGE
51
51
 
52
52
  # Create online repository in ABAP
53
53
  abapgit-agent create
@@ -69,7 +69,7 @@ abapgit-agent pull
69
69
  abapgit-agent pull --branch develop
70
70
 
71
71
  # Pull specific files only (fast iteration)
72
- abapgit-agent pull --files zcl_my_class.clas.abap,zif_my_intf.intf.abap
72
+ abapgit-agent pull --files src/zcl_my_class.clas.abap,src/zif_my_intf.intf.abap
73
73
 
74
74
  # Override git URL if needed
75
75
  abapgit-agent pull --url https://github.com/user/repo --branch main
@@ -88,20 +88,20 @@ abapgit-agent import --message "feat: add new feature"
88
88
 
89
89
  ```bash
90
90
  # Inspect source file for issues
91
- abapgit-agent inspect --files abap/zcl_my_class.clas.abap
91
+ abapgit-agent inspect --files src/zcl_my_class.clas.abap
92
92
 
93
93
  # Run AUnit tests for test classes
94
- abapgit-agent unit --files abap/zcl_my_test.clas.testclasses.abap
94
+ abapgit-agent unit --files src/zcl_my_test.clas.testclasses.abap
95
95
 
96
96
  # Run tests for multiple test classes
97
- abapgit-agent unit --files abap/zcl_test1.clas.testclasses.abap,abap/zcl_test2.clas.testclasses.abap
97
+ abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.clas.testclasses.abap
98
98
  ```
99
99
 
100
100
  ### Explore Commands
101
101
 
102
102
  ```bash
103
103
  # Display package hierarchy tree
104
- abapgit-agent tree --package $MY_PACKAGE
104
+ abapgit-agent tree --package '$MY_PACKAGE'
105
105
 
106
106
  # View object definitions from ABAP system (classes, interfaces, tables, data elements)
107
107
  abapgit-agent view --objects ZCL_MY_CLASS
package/abap/CLAUDE.md CHANGED
@@ -1,3 +1,10 @@
1
+ ---
2
+ layout: default
3
+ title: ABAP Project Guidelines
4
+ nav_order: 1
5
+ parent: ABAP Development
6
+ ---
7
+
1
8
  # ABAP Project Guidelines - Template
2
9
 
3
10
  This file provides guidelines for **generating ABAP code** in abapGit repositories.
@@ -78,14 +85,48 @@ The folder is configured in `.abapGitAgent` (property: `folder`):
78
85
 
79
86
  ---
80
87
 
81
- ### 4. NEVER Run Inspect Before Push/Pull (MOST IMPORTANT!)
88
+ ### 4. Use Syntax Command Before Commit (for CLAS, INTF, PROG)
82
89
 
83
90
  ```
84
- ❌ WRONG: Make changes → Run inspectCheck errors → Repeat
85
- ✅ CORRECT: Make changes → CommitPushRun pull Then inspect ONLY if pull fails
91
+ ❌ WRONG: Make changes → Commit Push Pull → Find errors → Fix → Repeat
92
+ ✅ CORRECT: Make changes → Run syntax Fix locally CommitPush Pull Done
86
93
  ```
87
94
 
88
- **Why**: Inspect runs against the ABAP system, not git. The code must be in git and pulled to ABAP first.
95
+ **For CLAS, INTF, PROG files**: Run `syntax` command BEFORE commit to catch errors early.
96
+
97
+ ```bash
98
+ # Check syntax of local code (no commit/push needed)
99
+ abapgit-agent syntax --files src/zcl_my_class.clas.abap
100
+
101
+ # Check multiple INDEPENDENT files
102
+ abapgit-agent syntax --files src/zcl_utils.clas.abap,src/zcl_logger.clas.abap
103
+ ```
104
+
105
+ **For other types (DDLS, FUGR, TABL, etc.)**: Skip syntax, proceed to commit/push/pull.
106
+
107
+ **Why use syntax command?**
108
+ - Catches syntax errors BEFORE polluting git history with fix commits
109
+ - No broken inactive objects in ABAP system
110
+ - Faster feedback loop - fix locally without commit/push/pull cycle
111
+ - Works even for NEW objects that don't exist in ABAP system yet
112
+
113
+ **⚠️ Important: Syntax checks files independently**
114
+
115
+ When checking multiple files, each is validated in isolation:
116
+ - ✅ **Use for**: Multiple independent files (bug fixes, unrelated changes)
117
+ - ❌ **Don't use for**: Files with dependencies (interface + implementing class)
118
+
119
+ **For dependent files, skip `syntax` and use `pull` instead:**
120
+ ```bash
121
+ # ❌ BAD - Interface and implementing class (may show false errors)
122
+ abapgit-agent syntax --files src/zif_my_intf.intf.abap,src/zcl_my_class.clas.abap
123
+
124
+ # ✅ GOOD - Use pull instead for dependent files
125
+ git add . && git commit && git push
126
+ abapgit-agent pull --files src/zif_my_intf.intf.abap,src/zcl_my_class.clas.abap
127
+ ```
128
+
129
+ **Note**: `inspect` still runs against ABAP system (requires pull first). Use `syntax` for pre-commit checking.
89
130
 
90
131
  ---
91
132
 
@@ -219,48 +260,126 @@ abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.cla
219
260
  3. Write code → place in correct folder (e.g., src/zcl_*.clas.abap)
220
261
 
221
262
 
222
- 4. Commit and push git add . && git commit && git push
263
+ 4. Syntax check (for CLAS, INTF, PROG only)
223
264
 
224
-
225
- 5. Activate → abapgit-agent pull --files src/file.clas.abap
265
+ ├─► CLAS/INTF/PROG → abapgit-agent syntax --files <file>
266
+ │ │
267
+ │ ├─► Errors? → Fix locally (no commit needed), re-run syntax
268
+ │ │
269
+ │ └─► Clean ✅ → Proceed to commit
270
+
271
+ └─► Other types (DDLS, FUGR, TABL, etc.) → Skip syntax, go to commit
272
+
273
+
274
+ 5. Commit and push → git add . && git commit && git push
226
275
 
227
276
 
228
- 6. VerifyCheck pull output
229
- - **Do NOT run inspect before commit/push/pull** - ABAP validates on pull
230
- - **Do NOT run unit before pull** - Tests run against ABAP system, code must be activated first
231
- - **"Error updating where-used list"** → This is a **SYNTAX ERROR** (check inspect for details)
232
- - Objects NOT in "Activated Objects" but in "Failed Objects Log" → Syntax error (check inspect)
233
- - Objects NOT appearing at all → XML metadata issue (check XML format in 08_abapgit.md)
277
+ 6. Activateabapgit-agent pull --files src/file.clas.abap
234
278
 
235
279
 
236
- 7. (Optional) Run unit tests abapgit-agent unit --files src/zcl_test.clas.testclasses.abap (ONLY if test file exists, AFTER successful pull)
280
+ 7. VerifyCheck pull output
281
+ - **"Error updating where-used list"** → SYNTAX ERROR (use inspect for details)
282
+ - Objects in "Failed Objects Log" → Syntax error (use inspect)
283
+ - Objects NOT appearing at all → XML metadata issue (check 08_abapgit.md)
237
284
 
238
285
 
239
- 8. If neededUse inspect to check syntax (runs against ABAP system)
286
+ 8. (Optional) Run unit tests abapgit-agent unit --files <testclass> (AFTER successful pull)
240
287
  ```
241
288
 
289
+ **Syntax Command - Supported Object Types:**
290
+
291
+ | Object Type | Syntax Command | What to Do |
292
+ |-------------|----------------|------------|
293
+ | CLAS (classes) | ✅ Supported | Run `syntax` before commit |
294
+ | CLAS (test classes: .testclasses.abap) | ✅ Supported | Run `syntax` before commit |
295
+ | INTF (interfaces) | ✅ Supported | Run `syntax` before commit |
296
+ | PROG (programs) | ✅ Supported | Run `syntax` before commit |
297
+ | DDLS (CDS views) | ❌ Not supported | Skip syntax, use `pull` then `inspect` |
298
+ | FUGR (function groups) | ❌ Not supported | Skip syntax, use `pull` then `inspect` |
299
+ | TABL/DTEL/DOMA/MSAG/SHLP | ❌ Not supported | Skip syntax, just `pull` |
300
+ | All other types | ❌ Not supported | Skip syntax, just `pull` |
301
+
242
302
  **IMPORTANT**:
303
+ - **Use `syntax` BEFORE commit** for CLAS/INTF/PROG (including test classes) - catches errors early, no git pollution
304
+ - **Syntax checks files INDEPENDENTLY** - no cross-file dependency support (e.g., interface definition not available when checking implementing class)
305
+ - **For dependent files** (interface + class, class + using class): Skip `syntax`, use `pull` directly
243
306
  - **ALWAYS push to git BEFORE running pull** - abapGit reads from git
244
- - **Use inspect AFTER pull** to check syntax on objects already in ABAP
245
- - **Check pull output**:
246
- - In "Failed Objects Log" → Syntax error (use inspect for details)
247
- - Not appearing at all XML metadata is wrong
307
+ - **Use `inspect` AFTER pull** for unsupported types or if pull fails
308
+
309
+ **Working with mixed file types:**
310
+ When modifying multiple files of different types (e.g., 1 class + 1 CDS view):
311
+ 1. Run `syntax` on supported files only (CLAS, INTF, PROG) - **only if they're independent**
312
+ 2. Commit ALL files together (including unsupported types)
313
+ 3. Push and pull ALL files together
314
+
315
+ Example:
316
+ ```bash
317
+ # Check syntax on independent class and interface only (skip CDS, skip if dependent)
318
+ abapgit-agent syntax --files src/zcl_my_class.clas.abap,src/zif_my_intf.intf.abap
319
+
320
+ # Commit and push all files including CDS
321
+ git add src/zcl_my_class.clas.abap src/zif_my_intf.intf.abap src/zc_my_view.ddls.asddls
322
+ git commit -m "feat: add class, interface, and CDS view"
323
+ git push
324
+
325
+ # Pull all files together
326
+ abapgit-agent pull --files src/zcl_my_class.clas.abap,src/zif_my_intf.intf.abap,src/zc_my_view.ddls.asddls
327
+ ```
328
+
329
+ **When to use syntax vs inspect vs view**:
330
+ - **syntax**: Check LOCAL code BEFORE commit (CLAS, INTF, PROG only)
331
+ - **inspect**: Check ACTIVATED code AFTER pull (all types, runs Code Inspector)
332
+ - **view**: Understand object STRUCTURE (not for debugging errors)
333
+
334
+ ### Quick Decision Tree for AI
335
+
336
+ **When user asks to modify/create ABAP code:**
248
337
 
249
- **When to use inspect vs view**:
250
- - **inspect**: Use when there are SYNTAX ERRORS (to find line numbers and details)
251
- - **view**: Use when you need to understand an object STRUCTURE (table fields, class methods)
252
- - Do NOT use view to debug syntax errors - view shows definitions, not errors
338
+ ```
339
+ 1. Identify file extension(s) AND dependencies
340
+ ├─ .clas.abap or .clas.testclasses.abap CLAS syntax supported (if independent)
341
+ ├─ .intf.abap INTF syntax supported (if independent)
342
+ ├─ .prog.abap → PROG ✅ syntax supported
343
+ ├─ .ddls.asddls → DDLS ❌ syntax not supported
344
+ └─ All other extensions → ❌ syntax not supported
345
+
346
+ 2. Check for dependencies:
347
+ ├─ Interface + implementing class? → Dependencies exist
348
+ ├─ Class A uses class B? → Dependencies exist
349
+ ├─ New objects that don't exist in ABAP system? → Check if they depend on each other
350
+ └─ Unrelated bug fixes across files? → No dependencies
351
+
352
+ 3. For SUPPORTED types (CLAS/INTF/PROG):
353
+ ├─ Independent files → Run syntax → Fix errors → Commit → Push → Pull
354
+ └─ Dependent files → Skip syntax → Commit → Push → Pull
355
+
356
+ 4. For UNSUPPORTED types (DDLS, FUGR, TABL, etc.):
357
+ Write code → Skip syntax → Commit → Push → Pull → (if errors: inspect)
358
+
359
+ 5. For MIXED types (some supported + some unsupported):
360
+ Write all code → Run syntax on independent supported files ONLY → Commit ALL → Push → Pull ALL
361
+ ```
362
+
363
+ **Error indicators after pull:**
364
+ - ❌ **"Error updating where-used list"** → SYNTAX ERROR - run `inspect` for details
365
+ - ❌ **Objects in "Failed Objects Log"** → SYNTAX ERROR - run `inspect`
366
+ - ❌ **Objects NOT appearing at all** → XML metadata issue (check `ref --topic abapgit`)
367
+ - ⚠️ **"Activated with warnings"** → Code Inspector warnings - run `inspect` to see details
253
368
 
254
369
  ### Commands
255
370
 
256
371
  ```bash
257
- # 1. Pull/activate after pushing to git (abapGit reads from git!)
372
+ # 1. Syntax check LOCAL code BEFORE commit (CLAS, INTF, PROG only)
373
+ abapgit-agent syntax --files src/zcl_my_class.clas.abap
374
+ abapgit-agent syntax --files src/zcl_class1.clas.abap,src/zif_intf1.intf.abap
375
+
376
+ # 2. Pull/activate AFTER pushing to git
258
377
  abapgit-agent pull --files src/zcl_class1.clas.abap,src/zcl_class2.clas.abap
259
378
 
260
- # 2. Inspect AFTER pull to check syntax (runs against ABAP system)
379
+ # 3. Inspect AFTER pull (for errors or unsupported types)
261
380
  abapgit-agent inspect --files src/zcl_class1.clas.abap
262
381
 
263
- # Run unit tests (multiple test classes)
382
+ # Run unit tests (after successful pull)
264
383
  abapgit-agent unit --files src/zcl_test1.clas.testclasses.abap,src/zcl_test2.clas.testclasses.abap
265
384
 
266
385
  # View object definitions (multiple objects)
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: Overview
4
+ nav_order: 1
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # ABAP Coding Guidelines Index
2
10
 
3
11
  This folder contains detailed ABAP coding guidelines that can be searched using the `ref` command.
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: SQL Best Practices
4
+ nav_order: 2
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # ABAP SQL Best Practices
2
10
 
3
11
  **Searchable keywords**: SELECT, FROM, WHERE, ABAP SQL, Open SQL, host variable, @ prefix, range table, INTO, UP TO, OFFSET, GROUP BY, JOIN
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: Exception Handling
4
+ nav_order: 3
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # Exception Handling - Classical vs Class-Based
2
10
 
3
11
  **Searchable keywords**: exception, RAISING, TRY, CATCH, cx_static_check, cx_dynamic_check, EXCEPTIONS, sy-subrc, class-based exception, classical exception
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: Unit Testing
4
+ nav_order: 4
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # Unit Testing
2
10
 
3
11
  **Searchable keywords**: unit test, AUnit, test class, cl_abap_unit_assert, FOR TESTING, setup, teardown, RISK LEVEL, DURATION, CDS test double, CL_CDS_TEST_ENVIRONMENT
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: CDS Views
4
+ nav_order: 5
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # Creating CDS Views
2
10
 
3
11
  **Searchable keywords**: CDS, DDL, DDLS, CDS view, @AbapCatalog, @AccessControl, association, projection, consumption
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: Classes & Objects
4
+ nav_order: 6
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # ABAP Classes and Objects
2
10
 
3
11
  **Searchable keywords**: CLASS, DEFINITION, PUBLIC, CREATE OBJECT, NEW, METHOD, INTERFACES, inheritance, FINAL, ABSTRACT
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: Naming Conventions
4
+ nav_order: 7
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # ABAP Object Naming Conventions
2
10
 
3
11
  **Searchable keywords**: naming convention, Z prefix, namespace, object type, CLAS, INTF, PROG, TABL, DDLS
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: JSON Handling
4
+ nav_order: 8
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # JSON Handling
2
10
 
3
11
  **Searchable keywords**: JSON, serialize, deserialize, /ui2/cl_json, REST API, API response
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: abapGit XML Metadata
4
+ nav_order: 9
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # abapGit Object XML Metadata
2
10
 
3
11
  Each ABAP object requires an XML metadata file for abapGit to understand how to serialize/deserialize it. This guide provides templates for common object types.
@@ -1,3 +1,11 @@
1
+ ---
2
+ layout: default
3
+ title: Unit Testable Code
4
+ nav_order: 10
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
1
9
  # ABAP Unit Testable Code Guidelines
2
10
 
3
11
  This document provides guidelines for creating ABAP OO classes/interfaces that can be easily unit tested with test doubles. These guidelines help AI coding tools understand how to design classes that are testable without requiring real dependencies.