abapgit-agent 1.0.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/.abapGitAgent.example +11 -0
- package/API.md +271 -0
- package/CLAUDE.md +445 -0
- package/CLAUDE_MEM.md +88 -0
- package/ERROR_HANDLING.md +30 -0
- package/INSTALL.md +160 -0
- package/README.md +127 -0
- package/abap/CLAUDE.md +492 -0
- package/abap/package.devc.xml +10 -0
- package/abap/zcl_abgagt_agent.clas.abap +769 -0
- package/abap/zcl_abgagt_agent.clas.xml +15 -0
- package/abap/zcl_abgagt_cmd_factory.clas.abap +43 -0
- package/abap/zcl_abgagt_cmd_factory.clas.xml +15 -0
- package/abap/zcl_abgagt_command_inspect.clas.abap +192 -0
- package/abap/zcl_abgagt_command_inspect.clas.testclasses.abap +121 -0
- package/abap/zcl_abgagt_command_inspect.clas.xml +16 -0
- package/abap/zcl_abgagt_command_pull.clas.abap +80 -0
- package/abap/zcl_abgagt_command_pull.clas.testclasses.abap +87 -0
- package/abap/zcl_abgagt_command_pull.clas.xml +16 -0
- package/abap/zcl_abgagt_command_unit.clas.abap +297 -0
- package/abap/zcl_abgagt_command_unit.clas.xml +15 -0
- package/abap/zcl_abgagt_resource_health.clas.abap +25 -0
- package/abap/zcl_abgagt_resource_health.clas.xml +15 -0
- package/abap/zcl_abgagt_resource_inspect.clas.abap +62 -0
- package/abap/zcl_abgagt_resource_inspect.clas.xml +15 -0
- package/abap/zcl_abgagt_resource_pull.clas.abap +71 -0
- package/abap/zcl_abgagt_resource_pull.clas.xml +15 -0
- package/abap/zcl_abgagt_resource_unit.clas.abap +64 -0
- package/abap/zcl_abgagt_resource_unit.clas.xml +15 -0
- package/abap/zcl_abgagt_rest_handler.clas.abap +27 -0
- package/abap/zcl_abgagt_rest_handler.clas.xml +15 -0
- package/abap/zcl_abgagt_util.clas.abap +93 -0
- package/abap/zcl_abgagt_util.clas.testclasses.abap +84 -0
- package/abap/zcl_abgagt_util.clas.xml +16 -0
- package/abap/zif_abgagt_agent.intf.abap +134 -0
- package/abap/zif_abgagt_agent.intf.xml +15 -0
- package/abap/zif_abgagt_cmd_factory.intf.abap +7 -0
- package/abap/zif_abgagt_cmd_factory.intf.xml +15 -0
- package/abap/zif_abgagt_command.intf.abap +21 -0
- package/abap/zif_abgagt_command.intf.xml +15 -0
- package/abap/zif_abgagt_util.intf.abap +28 -0
- package/abap/zif_abgagt_util.intf.xml +15 -0
- package/bin/abapgit-agent +902 -0
- package/img/claude.png +0 -0
- package/package.json +31 -0
- package/scripts/claude-integration.js +351 -0
- package/scripts/test-integration.js +139 -0
- package/src/abap-client.js +314 -0
- package/src/agent.js +119 -0
- package/src/config.js +66 -0
- package/src/index.js +48 -0
- package/src/logger.js +39 -0
- package/src/server.js +116 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"host": "your-sap-system.com",
|
|
3
|
+
"sapport": 443,
|
|
4
|
+
"client": "100",
|
|
5
|
+
"user": "TECH_USER",
|
|
6
|
+
"password": "your-password",
|
|
7
|
+
"language": "EN",
|
|
8
|
+
"gitUsername": "github-username",
|
|
9
|
+
"gitPassword": "github-token",
|
|
10
|
+
"referenceFolder": "~/abap-reference"
|
|
11
|
+
}
|
package/API.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# REST API Reference
|
|
2
|
+
|
|
3
|
+
The ABAP system exposes these endpoints via SICF handler: `sap/bc/z_abapgit_agent`
|
|
4
|
+
|
|
5
|
+
## Endpoints
|
|
6
|
+
|
|
7
|
+
| Method | Endpoint | Description |
|
|
8
|
+
|--------|----------|-------------|
|
|
9
|
+
| GET | `/health` | Health check (also fetches CSRF token) |
|
|
10
|
+
| POST | `/pull` | Pull and activate repository |
|
|
11
|
+
| POST | `/inspect` | Inspect source file for issues |
|
|
12
|
+
| POST | `/unit` | Execute unit tests (AUnit) |
|
|
13
|
+
|
|
14
|
+
## GET /health
|
|
15
|
+
|
|
16
|
+
Health check endpoint - also used to fetch CSRF token for POST requests.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
curl "https://your-system:44300/sap/bc/z_abapgit_agent/health" \
|
|
20
|
+
-u USER:PASSWORD \
|
|
21
|
+
-H "sap-client: 100"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Response:
|
|
25
|
+
```json
|
|
26
|
+
{"status":"OK","version":"1.0.0"}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## POST /pull
|
|
30
|
+
|
|
31
|
+
Pull and activate repository from git.
|
|
32
|
+
|
|
33
|
+
### Request
|
|
34
|
+
|
|
35
|
+
Requires CSRF token. First fetch from `/health`:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# 1. Get CSRF token and cookies
|
|
39
|
+
curl -c cookies.txt -D headers.txt -X GET "https://your-system:44300/sap/bc/z_abapgit_agent/health" \
|
|
40
|
+
-u USER:PASSWORD \
|
|
41
|
+
-H "sap-client: 100" \
|
|
42
|
+
-H "X-CSRF-Token: fetch"
|
|
43
|
+
|
|
44
|
+
# 2. Extract CSRF token
|
|
45
|
+
CSRF=$(grep -i "x-csrf-token" headers.txt | awk '{print $2}' | tr -d '\r')
|
|
46
|
+
|
|
47
|
+
# 3. Pull repository
|
|
48
|
+
curl -X POST "https://your-system:44300/sap/bc/z_abapgit_agent/pull" \
|
|
49
|
+
-H "Content-Type: application/json" \
|
|
50
|
+
-H "sap-client: 100" \
|
|
51
|
+
-H "X-CSRF-Token: $CSRF" \
|
|
52
|
+
-b cookies.txt \
|
|
53
|
+
-u USER:PASSWORD \
|
|
54
|
+
-d '{"url": "https://github.com/user/repo.git", "branch": "main"}'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Request Body
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"url": "https://github.com/user/repo.git",
|
|
62
|
+
"branch": "main",
|
|
63
|
+
"username": "git-username",
|
|
64
|
+
"password": "git-token",
|
|
65
|
+
"transport_request": "DEVK900001",
|
|
66
|
+
"files": ["zcl_my_class.clas.abap", "zcl_other.clas.abap"]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### File Format
|
|
71
|
+
|
|
72
|
+
Files are parsed to extract `(obj_type, obj_name)`:
|
|
73
|
+
- `zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS
|
|
74
|
+
- `src/zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS (subdirectory support)
|
|
75
|
+
|
|
76
|
+
### Transport Request
|
|
77
|
+
|
|
78
|
+
The optional `transport_request` field specifies a transport request number to use for activation:
|
|
79
|
+
- If provided, objects are activated in the specified transport
|
|
80
|
+
- If omitted, abapGit creates/uses a default transport
|
|
81
|
+
|
|
82
|
+
### Response (success)
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"success": "X",
|
|
87
|
+
"job_id": "CAIS20260208115649",
|
|
88
|
+
"message": "Pull completed successfully",
|
|
89
|
+
"transport_request": "DEVK900001",
|
|
90
|
+
"activated_count": 10,
|
|
91
|
+
"failed_count": 0,
|
|
92
|
+
"activated_objects": [...],
|
|
93
|
+
"failed_objects": [...]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Response (with activation errors)
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"success": "",
|
|
102
|
+
"job_id": "CAIS20260209041349",
|
|
103
|
+
"message": "Pull completed with errors",
|
|
104
|
+
"error_detail": "CLAS ZCL_MY_CLASS: Syntax error\nException: The statement...",
|
|
105
|
+
"transport_request": "DEVK900001",
|
|
106
|
+
"activated_count": 9,
|
|
107
|
+
"failed_count": 2,
|
|
108
|
+
"activated_objects": [...],
|
|
109
|
+
"failed_objects": [
|
|
110
|
+
{
|
|
111
|
+
"type": "E",
|
|
112
|
+
"text": "The statement METHOD is unexpected",
|
|
113
|
+
"obj_type": "CLAS",
|
|
114
|
+
"obj_name": "ZCL_MY_CLASS",
|
|
115
|
+
"exception": "The statement METHOD is unexpected"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## POST /inspect
|
|
122
|
+
|
|
123
|
+
Inspect source file for issues (currently runs syntax check via Code Inspector).
|
|
124
|
+
|
|
125
|
+
### Request Body
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"source_name": "ZCL_MY_CLASS.CLASS.ABAP"
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The endpoint parses the file name to extract `obj_type` and `obj_name`:
|
|
134
|
+
- `zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS
|
|
135
|
+
- `src/zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS
|
|
136
|
+
|
|
137
|
+
### Response (success)
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"success": "X",
|
|
142
|
+
"object_type": "CLAS",
|
|
143
|
+
"object_name": "ZCL_MY_CLASS",
|
|
144
|
+
"error_count": 0,
|
|
145
|
+
"errors": []
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Response (with errors)
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"success": "",
|
|
154
|
+
"object_type": "CLAS",
|
|
155
|
+
"object_name": "ZCL_MY_CLASS",
|
|
156
|
+
"error_count": 2,
|
|
157
|
+
"errors": [
|
|
158
|
+
{
|
|
159
|
+
"line": "15",
|
|
160
|
+
"column": "12",
|
|
161
|
+
"text": "\"MESSAGE\" is not a declaration"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"line": "20",
|
|
165
|
+
"column": "5",
|
|
166
|
+
"text": "Variable \"LV_TEST\" not found"
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## POST /unit
|
|
173
|
+
|
|
174
|
+
Execute unit tests (AUnit) for test class files.
|
|
175
|
+
|
|
176
|
+
### Request Body
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"files": ["zcl_my_test.clas.testclasses.abap", "zcl_other_test.clas.testclasses.abap"]
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The endpoint parses file names to extract `obj_type` and `obj_name`, then runs AUnit tests using `CL_SUT_AUNIT_RUNNER`.
|
|
185
|
+
|
|
186
|
+
### Response (success)
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"success": "X",
|
|
191
|
+
"test_count": 10,
|
|
192
|
+
"passed_count": 10,
|
|
193
|
+
"failed_count": 0,
|
|
194
|
+
"message": "All 10 tests passed",
|
|
195
|
+
"errors": []
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Response (with failures)
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"success": "",
|
|
204
|
+
"test_count": 5,
|
|
205
|
+
"passed_count": 3,
|
|
206
|
+
"failed_count": 2,
|
|
207
|
+
"message": "2 of 5 tests failed",
|
|
208
|
+
"errors": [
|
|
209
|
+
{
|
|
210
|
+
"class_name": "ZCL_MY_TEST",
|
|
211
|
+
"method_name": "TEST_METHOD_1",
|
|
212
|
+
"error_kind": "ERROR",
|
|
213
|
+
"error_text": "Expected X but got Y"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"class_name": "ZCL_MY_TEST",
|
|
217
|
+
"method_name": "TEST_METHOD_2",
|
|
218
|
+
"error_kind": "FAILURE",
|
|
219
|
+
"error_text": "Reference is initial"
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Response Structure
|
|
226
|
+
|
|
227
|
+
### Pull Response Fields
|
|
228
|
+
|
|
229
|
+
| Field | Type | Description |
|
|
230
|
+
|-------|------|-------------|
|
|
231
|
+
| `success` | String | 'X' for success, '' for errors |
|
|
232
|
+
| `job_id` | String | Job identifier |
|
|
233
|
+
| `message` | String | Status message |
|
|
234
|
+
| `error_detail` | String | Error details (if any) |
|
|
235
|
+
| `activated_count` | Integer | Number of activated objects |
|
|
236
|
+
| `failed_count` | Integer | Number of failed object entries |
|
|
237
|
+
| `started_at` | Timestamp | Start time of operation |
|
|
238
|
+
| `finished_at` | Timestamp | End time of operation |
|
|
239
|
+
| `log_messages` | Array | All log messages |
|
|
240
|
+
| `activated_objects` | Array | Unique successfully activated objects |
|
|
241
|
+
| `failed_objects` | Array | All error log entries |
|
|
242
|
+
|
|
243
|
+
### Syntax Check Response Fields
|
|
244
|
+
|
|
245
|
+
| Field | Type | Description |
|
|
246
|
+
|-------|------|-------------|
|
|
247
|
+
| `success` | String | 'X' for no errors, '' for errors |
|
|
248
|
+
| `object_type` | String | ABAP object type (e.g., 'CLAS', 'PROG') |
|
|
249
|
+
| `object_name` | String | ABAP object name |
|
|
250
|
+
| `error_count` | Integer | Number of syntax errors found |
|
|
251
|
+
| `errors` | Array | List of errors with line, column, text |
|
|
252
|
+
|
|
253
|
+
### Unit Test Response Fields
|
|
254
|
+
|
|
255
|
+
| Field | Type | Description |
|
|
256
|
+
|-------|------|-------------|
|
|
257
|
+
| `success` | String | 'X' for all tests passed, '' for failures |
|
|
258
|
+
| `test_count` | Integer | Total number of tests |
|
|
259
|
+
| `passed_count` | Integer | Number of passed tests |
|
|
260
|
+
| `failed_count` | Integer | Number of failed tests |
|
|
261
|
+
| `message` | String | Status message |
|
|
262
|
+
| `errors` | Array | Failed test details (empty if all tests pass) |
|
|
263
|
+
|
|
264
|
+
### Error Item Fields
|
|
265
|
+
|
|
266
|
+
| Field | Type | Description |
|
|
267
|
+
|-------|------|-------------|
|
|
268
|
+
| `class_name` | String | Test class name |
|
|
269
|
+
| `method_name` | String | Failed test method name |
|
|
270
|
+
| `error_kind` | String | Error type (e.g., 'ERROR', 'FAILURE') |
|
|
271
|
+
| `error_text` | String | Detailed error message from AUnit |
|