abapgit-agent 1.7.2 → 1.8.1

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 (40) hide show
  1. package/README.md +26 -8
  2. package/abap/CLAUDE.md +146 -26
  3. package/abap/guidelines/00_index.md +8 -0
  4. package/abap/guidelines/01_sql.md +28 -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 +151 -36
  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 +52 -3
  12. package/abap/guidelines/09_unit_testable_code.md +8 -0
  13. package/abap/guidelines/10_common_errors.md +95 -0
  14. package/bin/abapgit-agent +61 -2852
  15. package/package.json +21 -5
  16. package/src/agent.js +205 -16
  17. package/src/commands/create.js +102 -0
  18. package/src/commands/delete.js +72 -0
  19. package/src/commands/health.js +24 -0
  20. package/src/commands/help.js +111 -0
  21. package/src/commands/import.js +99 -0
  22. package/src/commands/init.js +321 -0
  23. package/src/commands/inspect.js +184 -0
  24. package/src/commands/list.js +143 -0
  25. package/src/commands/preview.js +277 -0
  26. package/src/commands/pull.js +278 -0
  27. package/src/commands/ref.js +96 -0
  28. package/src/commands/status.js +52 -0
  29. package/src/commands/syntax.js +340 -0
  30. package/src/commands/tree.js +209 -0
  31. package/src/commands/unit.js +133 -0
  32. package/src/commands/view.js +215 -0
  33. package/src/commands/where.js +138 -0
  34. package/src/config.js +11 -1
  35. package/src/utils/abap-http.js +347 -0
  36. package/src/utils/git-utils.js +58 -0
  37. package/src/utils/validators.js +72 -0
  38. package/src/utils/version-check.js +80 -0
  39. package/src/abap-client.js +0 -526
  40. /package/src/{ref-search.js → utils/abap-reference.js} +0 -0
@@ -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.
@@ -57,6 +65,7 @@ abapGit needs XML files to:
57
65
  <EXPOSURE>2</EXPOSURE>
58
66
  <STATE>1</STATE>
59
67
  <UNICODE>X</UNICODE>
68
+ <FIXPT>X</FIXPT>
60
69
  </VSEOCLASS>
61
70
  </asx:values>
62
71
  </asx:abap>
@@ -69,6 +78,9 @@ abapGit needs XML files to:
69
78
  - `EXPOSURE`: Exposure (2 = Public, 3 = Protected, 4 = Private)
70
79
  - `STATE`: State (1 = Active)
71
80
  - `UNICODE`: Unicode encoding (X = Yes)
81
+ - `FIXPT`: Fixed-point arithmetic (X = Yes) - **Always include for correct decimal arithmetic**
82
+
83
+ **Note**: `<FIXPT>X</FIXPT>` is default for modern ABAP. Without it, decimals treated as integers.
72
84
 
73
85
  **Local Classes**: If the class has local classes (e.g., test doubles), add:
74
86
  - `<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>` - for test classes
@@ -163,7 +175,41 @@ abapGit needs XML files to:
163
175
 
164
176
  ---
165
177
 
166
- ### CDS View (DDLS)
178
+ ### CDS View Entity (DDLS) - RECOMMENDED
179
+
180
+ **Use by default when user says "create CDS view"**
181
+
182
+ **Filename**: `src/zc_my_entity.ddls.xml`
183
+
184
+ ```xml
185
+ <?xml version="1.0" encoding="utf-8"?>
186
+ <abapGit version="v1.0.0" serializer="LCL_OBJECT_DDLS" serializer_version="v1.0.0">
187
+ <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
188
+ <asx:values>
189
+ <DDLS>
190
+ <DDLNAME>ZC_MY_ENTITY</DDLNAME>
191
+ <DDLANGUAGE>E</DDLANGUAGE>
192
+ <DDTEXT>My CDS View Entity</DDTEXT>
193
+ <SOURCE_TYPE>W</SOURCE_TYPE>
194
+ </DDLS>
195
+ </asx:values>
196
+ </asx:abap>
197
+ </abapGit>
198
+ ```
199
+
200
+ **Key Points for CDS View Entities**:
201
+ 1. **ABAP file extension**: Use `.ddls.asddls` (NOT `.ddls.abap`)
202
+ 2. **XML file**: Use `.ddls.xml`
203
+ 3. **DDLNAME**: Must match the CDS view entity name in the source
204
+ 4. **SOURCE_TYPE**: `W` = View Entity (modern, recommended)
205
+ 5. **Serializer**: Use `LCL_OBJECT_DDLS`
206
+ 6. **Source file**: Use `define view entity` (no `@AbapCatalog.sqlViewName`)
207
+
208
+ ---
209
+
210
+ ### CDS View (DDLS) - Legacy Only
211
+
212
+ **Only use when explicitly requested (e.g., "create legacy CDS view")**
167
213
 
168
214
  **Filename**: `src/zc_my_view.ddls.xml`
169
215
 
@@ -183,12 +229,15 @@ abapGit needs XML files to:
183
229
  </abapGit>
184
230
  ```
185
231
 
186
- **Key Points for CDS Views**:
232
+ **Key Points for CDS Views (Legacy)**:
187
233
  1. **ABAP file extension**: Use `.ddls.asddls` (NOT `.ddls.abap`)
188
234
  2. **XML file**: Use `.ddls.xml`
189
235
  3. **DDLNAME**: Must match the CDS view name in the source
190
- 4. **SOURCE_TYPE**: V = View, C = Consumption
236
+ 4. **SOURCE_TYPE**: `V` = View (legacy)
191
237
  5. **Serializer**: Use `LCL_OBJECT_DDLS`
238
+ 6. **Source file**: Must include `@AbapCatalog.sqlViewName` annotation
239
+
240
+ **For detailed comparison and usage guidance, see `guidelines/04_cds.md`**
192
241
 
193
242
  ---
194
243
 
@@ -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.
@@ -0,0 +1,95 @@
1
+ ---
2
+ layout: default
3
+ title: Common ABAP Errors
4
+ nav_order: 11
5
+ parent: ABAP Coding Guidelines
6
+ grand_parent: ABAP Development
7
+ ---
8
+
9
+ # Common ABAP Errors - Quick Fixes
10
+
11
+ **Searchable keywords**: error, syntax error, field mismatch, fixed point, comma, host variable, @ prefix, type incompatible
12
+
13
+ ## Fixed Point Arithmetic Error
14
+
15
+ ```
16
+ This ABAP SQL statement uses additions that can only be used when
17
+ the fixed point arithmetic flag is activated
18
+ ```
19
+
20
+ **Fix**: Add `<FIXPT>X</FIXPT>` to class XML.
21
+
22
+ ```xml
23
+ <VSEOCLASS>
24
+ ...
25
+ <FIXPT>X</FIXPT>
26
+ </VSEOCLASS>
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Field Name Mismatch
32
+
33
+ ```
34
+ The field 'CARRIERID' does not have a corresponding field in the work area
35
+ ```
36
+
37
+ **Fix**: Match structure field names with CDS view.
38
+
39
+ Check actual names: `abapgit-agent preview --objects <VIEW> --limit 1`
40
+
41
+ **Better fix**: Use CDS as type: `TYPE STANDARD TABLE OF zc_view WITH DEFAULT KEY`
42
+
43
+ ---
44
+
45
+ ## Missing Commas in SELECT
46
+
47
+ ```
48
+ The elements in the 'SELECT LIST' list must be separated using commas
49
+ ```
50
+
51
+ **Fix**: `SELECT carrid, connid, fldate` (add commas between fields)
52
+
53
+ ---
54
+
55
+ ## Missing @ Escape
56
+
57
+ ```
58
+ Either 'LT_RESULT' has to be escaped using '@' or qualified by a table name
59
+ ```
60
+
61
+ **Fix**: `INTO TABLE @lt_result WHERE field = @lv_param` (add @ prefix)
62
+
63
+ ---
64
+
65
+ ## Type Incompatible
66
+
67
+ ```
68
+ The data type of the component 'OCCUPANCYPERCENT' is not compatible
69
+ ```
70
+
71
+ **Fix for calculated CDS fields**: Use `TYPE decfloat34`
72
+
73
+ **Fix for other fields**: Use correct data element.
74
+
75
+ Find: `abapgit-agent view --objects <TABLE> --type TABL`
76
+
77
+ ---
78
+
79
+ ## Using Raw Types
80
+
81
+ ```abap
82
+ ❌ carrierid TYPE c LENGTH 3,
83
+ ✅ carrierid TYPE s_carr_id,
84
+ ```
85
+
86
+ **Rule**: Always use data elements, never raw types (c, n, p without reference).
87
+
88
+ Find data elements: `abapgit-agent view --objects <TABLE> --type TABL`
89
+
90
+ ---
91
+
92
+ ## See Also
93
+ - **ABAP SQL** (01_sql.md) - for SQL syntax rules
94
+ - **CDS Views** (04_cds.md) - for CDS selection patterns
95
+ - **abapGit** (08_abapgit.md) - for XML metadata templates