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
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
# ABAP Git Agent - CLI Tool Development
|
|
2
|
+
|
|
3
|
+
This is the **abapgit-agent** CLI tool project - a Node.js application for pulling and activating ABAP code from git repositories.
|
|
4
|
+
|
|
5
|
+
## Project Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
abapgit-agent/
|
|
9
|
+
├── bin/
|
|
10
|
+
│ └── abapgit-agent # CLI entry point
|
|
11
|
+
├── src/
|
|
12
|
+
│ ├── agent.js # Main agent class
|
|
13
|
+
│ ├── abap-client.js # REST client for ABAP communication
|
|
14
|
+
│ ├── config.js # Configuration management
|
|
15
|
+
│ ├── server.js # HTTP server
|
|
16
|
+
│ └── logger.js # Logging utilities
|
|
17
|
+
├── abap/ # ABAP backend components
|
|
18
|
+
│ ├── zcl_abapgit_agent*.clas.abap # Main agent class
|
|
19
|
+
│ ├── zif_abapgit_agent.intf.abap # Agent interface
|
|
20
|
+
│ ├── zcl_abgagt_cmd_factory.clas.abap # Command factory
|
|
21
|
+
│ ├── zcl_abgagt_command_*.clas.abap # Command implementations
|
|
22
|
+
│ ├── zif_abgagt_command.intf.abap # Command interface
|
|
23
|
+
│ ├── zcl_abgagt_resource_*.clas.abap # REST resource handlers
|
|
24
|
+
│ └── CLAUDE.md # ABAP project guidelines
|
|
25
|
+
└── tests/
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## ABAP Architecture
|
|
29
|
+
|
|
30
|
+
### Call Stack
|
|
31
|
+
```
|
|
32
|
+
CLI (bin/abapgit-agent)
|
|
33
|
+
↓
|
|
34
|
+
REST Client (src/abap-client.js)
|
|
35
|
+
↓
|
|
36
|
+
ABAP REST Handler (ZCL_ABGAGT_REST_HANDLER)
|
|
37
|
+
↓
|
|
38
|
+
Resource: ZCL_ABGAGT_RESOURCE_PULL → ZCL_ABGAGT_CMD_FACTORY → ZCL_ABGAGT_COMMAND_PULL → ZCL_ABGAGT_AGENT
|
|
39
|
+
Resource: ZCL_ABGAGT_RESOURCE_INSPECT → ZCL_ABGAGT_CMD_FACTORY → ZCL_ABGAGT_COMMAND_INSPECT → ZCL_ABGAGT_AGENT
|
|
40
|
+
Resource: ZCL_ABGAGT_RESOURCE_UNIT → ZCL_ABGAGT_CMD_FACTORY → ZCL_ABGAGT_COMMAND_UNIT → ZCL_ABGAGT_AGENT
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### ABAP Objects
|
|
44
|
+
|
|
45
|
+
| Object | Description |
|
|
46
|
+
|--------|-------------|
|
|
47
|
+
| `ZCL_ABGAGT_AGENT` | Main agent - handles pull, inspect, unit operations |
|
|
48
|
+
| `ZCL_ABGAGT_CMD_FACTORY` | Command factory - creates command instances dynamically |
|
|
49
|
+
| `ZCL_ABGAGT_COMMAND_PULL` | Pull command - implements ZIF_ABGAGT_COMMAND |
|
|
50
|
+
| `ZCL_ABGAGT_COMMAND_INSPECT` | Inspect command - implements ZIF_ABGAGT_COMMAND |
|
|
51
|
+
| `ZCL_ABGAGT_COMMAND_UNIT` | Unit command - implements ZIF_ABGAGT_COMMAND |
|
|
52
|
+
| `ZIF_ABGAGT_COMMAND` | Command interface with constants |
|
|
53
|
+
| `ZIF_ABGAGT_CMD_FACTORY` | Factory interface |
|
|
54
|
+
|
|
55
|
+
## CLI Commands
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Pull and activate from current git repo
|
|
59
|
+
abapgit-agent pull
|
|
60
|
+
|
|
61
|
+
# Pull specific files only (fast - recommended for iterative development)
|
|
62
|
+
abapgit-agent pull --files <file1>,<file2>,...
|
|
63
|
+
|
|
64
|
+
# Pull from specific branch
|
|
65
|
+
abapgit-agent pull --branch <branch>
|
|
66
|
+
|
|
67
|
+
# Pull from specific URL
|
|
68
|
+
abapgit-agent pull --url <git-url>
|
|
69
|
+
|
|
70
|
+
# Syntax check an ABAP file (IMPORTANT for debugging activation errors)
|
|
71
|
+
abapgit-agent inspect --files abap/zcl_my_class.clas.abap
|
|
72
|
+
|
|
73
|
+
# Run unit tests for ABAP test classes
|
|
74
|
+
abapgit-agent unit --files abap/zcl_my_test.clas.testclasses.abap
|
|
75
|
+
|
|
76
|
+
# Health check
|
|
77
|
+
abapgit-agent health
|
|
78
|
+
|
|
79
|
+
# Check configuration
|
|
80
|
+
abapgit-agent status
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Pull Command
|
|
84
|
+
|
|
85
|
+
### Description
|
|
86
|
+
Pull and activate ABAP objects from git repository.
|
|
87
|
+
|
|
88
|
+
### Usage
|
|
89
|
+
```bash
|
|
90
|
+
# Auto-detect git remote and branch from current directory
|
|
91
|
+
abapgit-agent pull
|
|
92
|
+
|
|
93
|
+
# Pull specific files only
|
|
94
|
+
abapgit-agent pull --files zcl_my_class.clas.abap,zif_my_intf.intf.abap
|
|
95
|
+
|
|
96
|
+
# Pull from specific branch
|
|
97
|
+
abapgit-agent pull --branch develop
|
|
98
|
+
|
|
99
|
+
# Pull from specific URL (useful for CI/CD)
|
|
100
|
+
abapgit-agent pull --url https://github.com/I045696/my-repo.git
|
|
101
|
+
|
|
102
|
+
# Combined options
|
|
103
|
+
abapgit-agent pull --branch develop --files src/zcl_my_class.clas.abap
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### File Format
|
|
107
|
+
Files are parsed to extract `(obj_type, obj_name)`:
|
|
108
|
+
- `zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS
|
|
109
|
+
- `zif_my_intf.intf.abap` → INTF, ZIF_MY_INTF
|
|
110
|
+
- `src/zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS (subdirectory support)
|
|
111
|
+
|
|
112
|
+
### Output
|
|
113
|
+
```
|
|
114
|
+
✅ Pull completed successfully!
|
|
115
|
+
Job ID: CAIS20260208115649
|
|
116
|
+
Message: Pull completed successfully
|
|
117
|
+
|
|
118
|
+
📋 Pull Log (N messages):
|
|
119
|
+
───────────────────────────────────────────────────────────────────────────────
|
|
120
|
+
Icon │ Object │ Message
|
|
121
|
+
...
|
|
122
|
+
|
|
123
|
+
📦 Activated Objects (N):
|
|
124
|
+
───────────────────────────────────────────────────────────────────────────────
|
|
125
|
+
✅ CLAS ZCL_MY_CLASS
|
|
126
|
+
...
|
|
127
|
+
|
|
128
|
+
❌ Failed Objects Log (M entries):
|
|
129
|
+
───────────────────────────────────────────────────────────────────────────────
|
|
130
|
+
❌ CLAS ZCL_MY_CLASS: Error message text
|
|
131
|
+
Exception: Exception details
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Key Behaviors
|
|
135
|
+
1. **Activated Objects** - Only includes objects that completed successfully (no errors in log)
|
|
136
|
+
2. **Failed Objects Log** - Shows all error messages (duplicates allowed for multiple errors per object)
|
|
137
|
+
3. **Error Details** - When errors occur, displays error detail section at the top
|
|
138
|
+
|
|
139
|
+
## Health Check
|
|
140
|
+
|
|
141
|
+
### Description
|
|
142
|
+
Check if the ABAP REST API is healthy.
|
|
143
|
+
|
|
144
|
+
### Usage
|
|
145
|
+
```bash
|
|
146
|
+
abapgit-agent health
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Output
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"status": "healthy",
|
|
153
|
+
"abap": "connected",
|
|
154
|
+
"version": "1.0.0"
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Unit Command
|
|
159
|
+
|
|
160
|
+
### Description
|
|
161
|
+
Run AUnit tests for ABAP test classes and display detailed results including failed test methods with error messages.
|
|
162
|
+
|
|
163
|
+
### Usage
|
|
164
|
+
```bash
|
|
165
|
+
# Run unit tests for a single test class file
|
|
166
|
+
abapgit-agent unit --files abap/zcl_my_test.clas.testclasses.abap
|
|
167
|
+
|
|
168
|
+
# Run unit tests for multiple test class files
|
|
169
|
+
abapgit-agent unit --files abap/zcl_test1.clas.testclasses.abap,abap/zcl_test2.clas.testclasses.abap
|
|
170
|
+
|
|
171
|
+
# Run unit tests for a specific package
|
|
172
|
+
abapgit-agent unit --package $MY_PACKAGE
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### File Format
|
|
176
|
+
The command accepts test class files (`.clas.testclasses.abap`):
|
|
177
|
+
- `zcl_my_test.clas.testclasses.abap` → CLAS, ZCL_MY_TEST
|
|
178
|
+
- `src/tests/zcl_my_test.clas.testclasses.abap` → CLAS, ZCL_MY_TEST (with path)
|
|
179
|
+
|
|
180
|
+
### Output
|
|
181
|
+
```
|
|
182
|
+
✅ ZCL_MY_TEST - All tests passed
|
|
183
|
+
Tests: 10 | Passed: 10 | Failed: 0
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
When tests fail:
|
|
187
|
+
```
|
|
188
|
+
❌ ZCL_MY_TEST - Tests failed
|
|
189
|
+
Tests: 10 | Passed: 8 | Failed: 2
|
|
190
|
+
✗ ZCL_MY_TEST=>TEST_METHOD_1: Error description
|
|
191
|
+
✗ ZCL_MY_TEST=>TEST_METHOD_2: Another error
|
|
192
|
+
|
|
193
|
+
Failed Tests:
|
|
194
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
195
|
+
✗ ZCL_MY_TEST=>TEST_METHOD_1
|
|
196
|
+
Error: Expected X but got Y
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Error Details
|
|
200
|
+
When a test fails, the output includes:
|
|
201
|
+
- **Test Class**: The class containing the failed test
|
|
202
|
+
- **Method**: The failed test method name (with `=>` notation)
|
|
203
|
+
- **Error Kind**: Type of error (e.g., 'ERROR', 'FAILURE')
|
|
204
|
+
- **Error Text**: Detailed error message from AUnit
|
|
205
|
+
|
|
206
|
+
### Response JSON Structure
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"success": "X",
|
|
210
|
+
"message": "2 of 10 tests failed",
|
|
211
|
+
"test_count": 10,
|
|
212
|
+
"passed_count": 8,
|
|
213
|
+
"failed_count": 2,
|
|
214
|
+
"errors": [
|
|
215
|
+
{
|
|
216
|
+
"class_name": "ZCL_MY_TEST",
|
|
217
|
+
"method_name": "TEST_METHOD_1",
|
|
218
|
+
"error_kind": "ERROR",
|
|
219
|
+
"error_text": "Expected X but got Y"
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Implementation
|
|
226
|
+
The unit command uses `CL_SUT_AUNIT_RUNNER` to execute AUnit tests:
|
|
227
|
+
- `CL_SUT_AUNIT_RUNNER=>S_CREATE` - Create test runner
|
|
228
|
+
- `run()` - Execute tests
|
|
229
|
+
- `str_results` - Get test statistics (cnt_testmethods, cnt_ok_methods, cnt_error_methods)
|
|
230
|
+
- `tab_objects` - Get detailed results with nested structure:
|
|
231
|
+
- `TAB_TESTCLASSES` → `TAB_METHODS` → `STR_ERROR` → `STR_ERROR_CORE`
|
|
232
|
+
|
|
233
|
+
## Status Check
|
|
234
|
+
|
|
235
|
+
### Description
|
|
236
|
+
Check if ABAP integration is configured for the current repository.
|
|
237
|
+
|
|
238
|
+
### Usage
|
|
239
|
+
```bash
|
|
240
|
+
abapgit-agent status
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Output
|
|
244
|
+
```
|
|
245
|
+
✅ ABAP Git Agent is ENABLED
|
|
246
|
+
Config location: /path/to/repo/.abapGitAgent
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Or if not configured:
|
|
250
|
+
```
|
|
251
|
+
❌ ABAP Git Agent is NOT configured
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Configuration
|
|
255
|
+
|
|
256
|
+
### File-based (.abapGitAgent)
|
|
257
|
+
Create `.abapGitAgent` in repository root:
|
|
258
|
+
```json
|
|
259
|
+
{
|
|
260
|
+
"host": "your-sap-system.com",
|
|
261
|
+
"sapport": 443,
|
|
262
|
+
"client": "100",
|
|
263
|
+
"user": "TECH_USER",
|
|
264
|
+
"password": "your-password",
|
|
265
|
+
"language": "EN",
|
|
266
|
+
"gitUsername": "git-username",
|
|
267
|
+
"gitPassword": "git-token"
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Configuration Options
|
|
272
|
+
|
|
273
|
+
| Option | Description | Default |
|
|
274
|
+
|--------|-------------|---------|
|
|
275
|
+
| `host` | SAP system hostname | Required |
|
|
276
|
+
| `sapport` | SAP port (usually 443) | 443 |
|
|
277
|
+
| `client` | SAP client number | 100 |
|
|
278
|
+
| `user` | SAP username | Required |
|
|
279
|
+
| `password` | SAP password | Required |
|
|
280
|
+
| `language` | SAP language | EN |
|
|
281
|
+
| `gitUsername` | Git username/token | Optional |
|
|
282
|
+
| `gitPassword` | Git password/token | Optional |
|
|
283
|
+
|
|
284
|
+
### Environment Variables
|
|
285
|
+
```bash
|
|
286
|
+
export ABAP_HOST="your-sap-system.com"
|
|
287
|
+
export ABAP_PORT=443
|
|
288
|
+
export ABAP_CLIENT="100"
|
|
289
|
+
export ABAP_USER="TECH_USER"
|
|
290
|
+
export ABAP_PASSWORD="your-password"
|
|
291
|
+
export ABAP_LANGUAGE="EN"
|
|
292
|
+
export GIT_USERNAME="git-username"
|
|
293
|
+
export GIT_PASSWORD="git-token"
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Development Workflow
|
|
297
|
+
|
|
298
|
+
### CLI Tool Development
|
|
299
|
+
|
|
300
|
+
1. Make changes to CLI code (JavaScript)
|
|
301
|
+
2. Test locally: `node bin/abapgit-agent pull`
|
|
302
|
+
3. Test against real ABAP system
|
|
303
|
+
4. Commit and push
|
|
304
|
+
|
|
305
|
+
### ABAP Backend Development
|
|
306
|
+
|
|
307
|
+
1. Make changes to ABAP backend (abap/ folder)
|
|
308
|
+
2. Pull only changed files (faster):
|
|
309
|
+
```bash
|
|
310
|
+
abapgit-agent pull --files abap/zcl_my_class.clas.abap
|
|
311
|
+
```
|
|
312
|
+
Or pull all files:
|
|
313
|
+
```bash
|
|
314
|
+
abapgit-agent pull
|
|
315
|
+
```
|
|
316
|
+
3. Commit and push
|
|
317
|
+
4. Deploy changes via abapGit to your SAP system
|
|
318
|
+
|
|
319
|
+
### Fast Iteration Workflow
|
|
320
|
+
|
|
321
|
+
For quick ABAP code changes:
|
|
322
|
+
1. Make small change to ABAP file
|
|
323
|
+
2. `git add <file> && git commit -m "fix"`
|
|
324
|
+
3. `abapgit-agent pull --files <file>` (seconds, not minutes)
|
|
325
|
+
4. Verify activation results
|
|
326
|
+
5. Repeat until done
|
|
327
|
+
|
|
328
|
+
## For ABAP Code Generation
|
|
329
|
+
|
|
330
|
+
**NOTE**: This file is for developing the CLI tool itself. For guidelines on **generating ABAP code** for abapGit repositories, see `/abap/CLAUDE.md`. Copy that file to your ABAP repository root when setting up new projects.
|
|
331
|
+
|
|
332
|
+
## ABAP Unit Tests
|
|
333
|
+
|
|
334
|
+
### File Structure
|
|
335
|
+
- Main class: `zcl_xxx.clas.abap`
|
|
336
|
+
- Test class: `zcl_xxx.clas.testclasses.abap`
|
|
337
|
+
- No separate XML needed for test classes
|
|
338
|
+
|
|
339
|
+
### XML Configuration
|
|
340
|
+
Add `<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>` to main class XML file:
|
|
341
|
+
```xml
|
|
342
|
+
<VSEOCLASS>
|
|
343
|
+
<CLSNAME>ZCL_ABGAGT_UTIL</CLSNAME>
|
|
344
|
+
...
|
|
345
|
+
<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
|
|
346
|
+
</VSEOCLASS>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Test Class Naming
|
|
350
|
+
- Short name: `ltcl_<name>` (e.g., `ltcl_util`, not `ltcl_abgagt_util_test`)
|
|
351
|
+
- Must include `FINAL` keyword
|
|
352
|
+
- **CRITICAL: Class name MUST NOT exceed 30 characters!**
|
|
353
|
+
- Example: `ltcl_cmd_inspect` (18 chars) is OK
|
|
354
|
+
- `ltcl_zcl_abgagt_command_infect` (32 chars) is NOT OK
|
|
355
|
+
|
|
356
|
+
### Test Class Declaration
|
|
357
|
+
```abap
|
|
358
|
+
CLASS ltcl_util DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Test Methods
|
|
362
|
+
- Must have `FOR TESTING` keyword
|
|
363
|
+
- Can optionally include `RAISING <exception>`
|
|
364
|
+
- **CRITICAL: Method names MUST NOT exceed 30 characters!**
|
|
365
|
+
- Example: `test_exec_multi_files` (20 chars) is OK
|
|
366
|
+
- `test_exec_multiple_files` (25 chars) is OK
|
|
367
|
+
- `test_exec_multiple_files_with_long_name` (40 chars) is NOT OK
|
|
368
|
+
|
|
369
|
+
### Setup Method
|
|
370
|
+
```abap
|
|
371
|
+
METHOD setup.
|
|
372
|
+
mo_util = zcl_abgagt_util=>get_instance( ).
|
|
373
|
+
ENDMETHOD.
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Assertions
|
|
377
|
+
Use `CL_ABAP_UNIT_ASSERT` class:
|
|
378
|
+
- `assert_equals( act = lv_act exp = lv_exp msg = 'message' )`
|
|
379
|
+
- `assert_initial( act = lv_act msg = 'message' )`
|
|
380
|
+
- `assert_not_initial( act = lv_act msg = 'message' )`
|
|
381
|
+
|
|
382
|
+
### Method Call Format
|
|
383
|
+
- Instance methods: `mo_object->method( )`
|
|
384
|
+
- Class/static methods: `zcl_class=>method( )`
|
|
385
|
+
|
|
386
|
+
### DATA() vs VALUE #() Rule
|
|
387
|
+
**When assigning to a typed variable, ABAP can infer the type from the target.**
|
|
388
|
+
|
|
389
|
+
**CORRECT:**
|
|
390
|
+
```abap
|
|
391
|
+
" When target has explicit type, VALUE #() infers from it
|
|
392
|
+
DATA lt_so_class TYPE RANGE OF seoaliases-clsname.
|
|
393
|
+
lt_so_class = VALUE #( ( sign = 'I' option = 'EQ' low = lv_value ) ).
|
|
394
|
+
|
|
395
|
+
" Or append with inline VALUE
|
|
396
|
+
APPEND VALUE #( sign = 'I' option = 'EQ' low = lv_value ) TO lt_so_class.
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**WRONG (untyped variable):**
|
|
400
|
+
```abap
|
|
401
|
+
DATA(ls_range) = VALUE #( sign = 'I' option = 'EQ' low = lv_value ). " Type unknown!
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Example Test Class
|
|
405
|
+
```abap
|
|
406
|
+
*----------------------------------------------------------------------*
|
|
407
|
+
* CLASS ltcl_util DEFINITION
|
|
408
|
+
*----------------------------------------------------------------------*
|
|
409
|
+
CLASS ltcl_util DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
|
|
410
|
+
|
|
411
|
+
PRIVATE SECTION.
|
|
412
|
+
METHODS setup.
|
|
413
|
+
DATA mo_util TYPE REF TO zcl_abgagt_util.
|
|
414
|
+
|
|
415
|
+
METHODS parse_class_file FOR TESTING.
|
|
416
|
+
|
|
417
|
+
ENDCLASS.
|
|
418
|
+
|
|
419
|
+
*----------------------------------------------------------------------*
|
|
420
|
+
* CLASS ltcl_util IMPLEMENTATION
|
|
421
|
+
*----------------------------------------------------------------------*
|
|
422
|
+
CLASS ltcl_util IMPLEMENTATION.
|
|
423
|
+
|
|
424
|
+
METHOD setup.
|
|
425
|
+
mo_util = zcl_abgagt_util=>get_instance( ).
|
|
426
|
+
ENDMETHOD.
|
|
427
|
+
|
|
428
|
+
METHOD parse_class_file.
|
|
429
|
+
DATA lv_file TYPE string VALUE 'zcl_my_class.clas.abap'.
|
|
430
|
+
DATA lv_obj_type TYPE string.
|
|
431
|
+
DATA lv_obj_name TYPE string.
|
|
432
|
+
|
|
433
|
+
mo_util->zif_abgagt_util~parse_file_to_object(
|
|
434
|
+
EXPORTING iv_file = lv_file
|
|
435
|
+
IMPORTING ev_obj_type = lv_obj_type
|
|
436
|
+
ev_obj_name = lv_obj_name ).
|
|
437
|
+
|
|
438
|
+
cl_abap_unit_assert=>assert_equals(
|
|
439
|
+
act = lv_obj_type
|
|
440
|
+
exp = 'CLAS'
|
|
441
|
+
msg = 'Object type should be CLAS' ).
|
|
442
|
+
ENDMETHOD.
|
|
443
|
+
|
|
444
|
+
ENDCLASS.
|
|
445
|
+
```
|
package/CLAUDE_MEM.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# claude-mem for ABAP Knowledge Management
|
|
2
|
+
|
|
3
|
+
claude-mem is a Claude Code plugin that stores memories across sessions. Use it to retain ABAP knowledge learned from the reference repositories.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
1. Install the plugin:
|
|
8
|
+
```bash
|
|
9
|
+
/plugin marketplace add thedotmack/claude-mem
|
|
10
|
+
/plugin install claude-mem
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start: Explore All Reference Docs at Once
|
|
14
|
+
|
|
15
|
+
Use `claude-mem:make-plan` to bulk explore the abap-reference folder and save all knowledge:
|
|
16
|
+
|
|
17
|
+
1. In Claude Code, invoke the skill:
|
|
18
|
+
```
|
|
19
|
+
/claude-mem:make-plan
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. Provide instructions to explore all reference repos:
|
|
23
|
+
```
|
|
24
|
+
Explore the abap-reference folder at /Users/i045696/Documents/code/abap-reference
|
|
25
|
+
|
|
26
|
+
It contains:
|
|
27
|
+
- abapGit: ABAP file format patterns for abapGit deployment
|
|
28
|
+
- styleguides: Clean ABAP coding standards
|
|
29
|
+
- abap-cheat-sheets: Code snippets and examples
|
|
30
|
+
|
|
31
|
+
Save all ABAP patterns and conventions to claude-mem memory:
|
|
32
|
+
- ABAP class file format (ZCL_*.clas.abap, XML metadata)
|
|
33
|
+
- Clean ABAP naming conventions
|
|
34
|
+
- Authorization check patterns
|
|
35
|
+
- Dynamic method calls
|
|
36
|
+
- Syntax check via Code Inspector
|
|
37
|
+
|
|
38
|
+
Focus on copy-ready patterns and code examples.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
3. The subagent will:
|
|
42
|
+
- Explore each repository
|
|
43
|
+
- Extract patterns and examples
|
|
44
|
+
- **Automatically save memories** to claude-mem
|
|
45
|
+
- Create a plan document for reference
|
|
46
|
+
|
|
47
|
+
## Manual Knowledge Saving
|
|
48
|
+
|
|
49
|
+
When you discover specific ABAP patterns, save them:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
/claude-mem:do
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This launches a subagent to implement your task and **automatically save memories**.
|
|
56
|
+
|
|
57
|
+
## Retrieving Knowledge
|
|
58
|
+
|
|
59
|
+
When you need to recall previously learned ABAP patterns:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
/claude-mem:mem-search
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then search for topics like:
|
|
66
|
+
- "ABAP class structure"
|
|
67
|
+
- "Clean ABAP naming"
|
|
68
|
+
- "Authorization check"
|
|
69
|
+
- "Dynamic method call"
|
|
70
|
+
- "abapGit syntax check"
|
|
71
|
+
|
|
72
|
+
## Key Memory Topics
|
|
73
|
+
|
|
74
|
+
| Topic | What to Save |
|
|
75
|
+
|-------|-------------|
|
|
76
|
+
| abapGit format | `ZCL_*.clas.abap`, XML metadata pattern |
|
|
77
|
+
| Clean ABAP | Naming conventions, patterns, anti-patterns |
|
|
78
|
+
| Authorization | `AUTHORITY-CHECK` syntax, activity values |
|
|
79
|
+
| Dynamic calls | `CALL METHOD (class)=>(method)` |
|
|
80
|
+
| Syntax check | `zcl_abapgit_code_inspector=>run()` |
|
|
81
|
+
|
|
82
|
+
## Workflow
|
|
83
|
+
|
|
84
|
+
1. **First time**: Use `claude-mem:make-plan` to explore and save all reference docs
|
|
85
|
+
2. **During work**: Use `claude-mem:do` to save new discoveries
|
|
86
|
+
3. **When needed**: Use `claude-mem:mem-search` to recall patterns
|
|
87
|
+
|
|
88
|
+
claude-mem persists across sessions - your learned knowledge is saved.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Error Handling
|
|
2
|
+
|
|
3
|
+
## Error Types
|
|
4
|
+
|
|
5
|
+
| Error Type | Response | Handling |
|
|
6
|
+
|------------|----------|----------|
|
|
7
|
+
| Syntax Error | `success=""`, `error_detail` contains object names | Claude fixes and repulls |
|
|
8
|
+
| Activation Error | `success=""`, `error_detail` contains inactive objects | Check TADIR for details |
|
|
9
|
+
| Network Timeout | HTTP timeout | Retry request |
|
|
10
|
+
| Repository Not Found | `success=""`, message="Repository not found" | Verify URL |
|
|
11
|
+
|
|
12
|
+
## Troubleshooting
|
|
13
|
+
|
|
14
|
+
### REST API not accessible
|
|
15
|
+
|
|
16
|
+
1. Check SICF activation: `sap/bc/z_abapgit_agent`
|
|
17
|
+
2. Verify handler class: `ZCL_ABAPGIT_AGENT_HANDLER`
|
|
18
|
+
3. Check authorization
|
|
19
|
+
|
|
20
|
+
### Agent cannot connect to ABAP
|
|
21
|
+
|
|
22
|
+
1. Verify REST API URL in .abapGitAgent
|
|
23
|
+
2. Check credentials in .abapGitAgent
|
|
24
|
+
3. Test REST API directly with curl
|
|
25
|
+
|
|
26
|
+
### Activation errors not shown
|
|
27
|
+
|
|
28
|
+
1. Check TADIR for inactive objects in the package
|
|
29
|
+
2. Verify abapGit settings for activation
|
|
30
|
+
3. Check SE80 for object activation status
|