abapgit-agent 1.4.0 → 1.6.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/README.md +2 -0
- package/abap/guidelines/00_index.md +35 -0
- package/abap/guidelines/01_sql.md +72 -0
- package/abap/guidelines/02_exceptions.md +108 -0
- package/abap/guidelines/03_testing.md +252 -0
- package/abap/guidelines/04_cds.md +120 -0
- package/abap/guidelines/05_classes.md +50 -0
- package/abap/guidelines/06_objects.md +103 -0
- package/abap/guidelines/07_json.md +22 -0
- package/abap/guidelines/08_abapgit.md +193 -0
- package/bin/abapgit-agent +597 -44
- package/bin/abgagt +24 -0
- package/package.json +11 -3
- package/src/abap-client.js +65 -2
- package/src/agent.js +58 -4
- package/src/config.js +9 -2
- package/src/ref-search.js +989 -0
- package/.abapGitAgent.example +0 -11
- package/.github/workflows/release.yml +0 -57
- package/API.md +0 -710
- package/CLAUDE.md +0 -1031
- package/CLAUDE_MEM.md +0 -88
- package/ERROR_HANDLING.md +0 -30
- package/INSTALL.md +0 -155
- package/RELEASE_NOTES.md +0 -143
- package/abap/CLAUDE.md +0 -898
- package/abap/copilot-instructions.md +0 -79
- package/abap/package.devc.xml +0 -10
- package/abap/zcl_abgagt_agent.clas.abap +0 -420
- package/abap/zcl_abgagt_agent.clas.xml +0 -15
- package/abap/zcl_abgagt_cmd_factory.clas.abap +0 -48
- package/abap/zcl_abgagt_cmd_factory.clas.xml +0 -15
- package/abap/zcl_abgagt_command_create.clas.abap +0 -95
- package/abap/zcl_abgagt_command_create.clas.xml +0 -15
- package/abap/zcl_abgagt_command_import.clas.abap +0 -138
- package/abap/zcl_abgagt_command_import.clas.xml +0 -15
- package/abap/zcl_abgagt_command_inspect.clas.abap +0 -411
- package/abap/zcl_abgagt_command_inspect.clas.testclasses.abap +0 -121
- package/abap/zcl_abgagt_command_inspect.clas.xml +0 -16
- package/abap/zcl_abgagt_command_preview.clas.abap +0 -386
- package/abap/zcl_abgagt_command_preview.clas.xml +0 -15
- package/abap/zcl_abgagt_command_pull.clas.abap +0 -80
- package/abap/zcl_abgagt_command_pull.clas.testclasses.abap +0 -87
- package/abap/zcl_abgagt_command_pull.clas.xml +0 -16
- package/abap/zcl_abgagt_command_tree.clas.abap +0 -237
- package/abap/zcl_abgagt_command_tree.clas.xml +0 -15
- package/abap/zcl_abgagt_command_unit.clas.abap +0 -297
- package/abap/zcl_abgagt_command_unit.clas.xml +0 -15
- package/abap/zcl_abgagt_command_view.clas.abap +0 -240
- package/abap/zcl_abgagt_command_view.clas.xml +0 -15
- package/abap/zcl_abgagt_resource_create.clas.abap +0 -71
- package/abap/zcl_abgagt_resource_create.clas.xml +0 -15
- package/abap/zcl_abgagt_resource_health.clas.abap +0 -25
- package/abap/zcl_abgagt_resource_health.clas.xml +0 -15
- package/abap/zcl_abgagt_resource_import.clas.abap +0 -66
- package/abap/zcl_abgagt_resource_import.clas.xml +0 -15
- package/abap/zcl_abgagt_resource_inspect.clas.abap +0 -62
- package/abap/zcl_abgagt_resource_inspect.clas.xml +0 -15
- package/abap/zcl_abgagt_resource_preview.clas.abap +0 -67
- package/abap/zcl_abgagt_resource_preview.clas.xml +0 -15
- package/abap/zcl_abgagt_resource_pull.clas.abap +0 -71
- package/abap/zcl_abgagt_resource_pull.clas.xml +0 -15
- package/abap/zcl_abgagt_resource_tree.clas.abap +0 -70
- package/abap/zcl_abgagt_resource_tree.clas.xml +0 -15
- package/abap/zcl_abgagt_resource_unit.clas.abap +0 -64
- package/abap/zcl_abgagt_resource_unit.clas.xml +0 -15
- package/abap/zcl_abgagt_resource_view.clas.abap +0 -68
- package/abap/zcl_abgagt_resource_view.clas.xml +0 -15
- package/abap/zcl_abgagt_rest_handler.clas.abap +0 -32
- package/abap/zcl_abgagt_rest_handler.clas.xml +0 -15
- package/abap/zcl_abgagt_util.clas.abap +0 -93
- package/abap/zcl_abgagt_util.clas.testclasses.abap +0 -84
- package/abap/zcl_abgagt_util.clas.xml +0 -16
- package/abap/zcl_abgagt_viewer_clas.clas.abap +0 -58
- package/abap/zcl_abgagt_viewer_clas.clas.xml +0 -15
- package/abap/zcl_abgagt_viewer_ddls.clas.abap +0 -83
- package/abap/zcl_abgagt_viewer_ddls.clas.xml +0 -15
- package/abap/zcl_abgagt_viewer_dtel.clas.abap +0 -98
- package/abap/zcl_abgagt_viewer_dtel.clas.xml +0 -15
- package/abap/zcl_abgagt_viewer_factory.clas.abap +0 -41
- package/abap/zcl_abgagt_viewer_factory.clas.xml +0 -15
- package/abap/zcl_abgagt_viewer_intf.clas.abap +0 -58
- package/abap/zcl_abgagt_viewer_intf.clas.xml +0 -15
- package/abap/zcl_abgagt_viewer_stru.clas.abap +0 -59
- package/abap/zcl_abgagt_viewer_stru.clas.xml +0 -15
- package/abap/zcl_abgagt_viewer_tabl.clas.abap +0 -59
- package/abap/zcl_abgagt_viewer_tabl.clas.xml +0 -15
- package/abap/zcl_abgagt_viewer_ttyp.clas.abap +0 -93
- package/abap/zcl_abgagt_viewer_ttyp.clas.xml +0 -15
- package/abap/zif_abgagt_agent.intf.abap +0 -53
- package/abap/zif_abgagt_agent.intf.xml +0 -15
- package/abap/zif_abgagt_cmd_factory.intf.abap +0 -7
- package/abap/zif_abgagt_cmd_factory.intf.xml +0 -15
- package/abap/zif_abgagt_command.intf.abap +0 -26
- package/abap/zif_abgagt_command.intf.xml +0 -15
- package/abap/zif_abgagt_util.intf.abap +0 -28
- package/abap/zif_abgagt_util.intf.xml +0 -15
- package/abap/zif_abgagt_viewer.intf.abap +0 -12
- package/abap/zif_abgagt_viewer.intf.xml +0 -15
- package/docs/commands.md +0 -142
- package/docs/create-command.md +0 -129
- package/docs/health-command.md +0 -89
- package/docs/import-command.md +0 -195
- package/docs/init-command.md +0 -189
- package/docs/inspect-command.md +0 -158
- package/docs/preview-command.md +0 -528
- package/docs/pull-command.md +0 -188
- package/docs/status-command.md +0 -68
- package/docs/tree-command.md +0 -303
- package/docs/unit-command.md +0 -167
- package/docs/view-command.md +0 -501
- package/img/claude.png +0 -0
- package/scripts/claude-integration.js +0 -351
- package/scripts/release.sh +0 -60
- package/scripts/test-integration.js +0 -139
package/CLAUDE.md
DELETED
|
@@ -1,1031 +0,0 @@
|
|
|
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
|
-
## Quick Reference
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Quick commands
|
|
9
|
-
abapgit-agent pull # Pull and activate all
|
|
10
|
-
abapgit-agent pull --files file.clas.abap # Pull specific file(s)
|
|
11
|
-
abapgit-agent inspect --files file.clas.abap # Syntax check
|
|
12
|
-
abapgit-agent unit --files test.clas.testclasses.abap # Run tests
|
|
13
|
-
abapgit-agent preview --objects TABLE # Preview table data
|
|
14
|
-
abapgit-agent view --objects OBJ # View object definition
|
|
15
|
-
abapgit-agent tree --package $PACKAGE # Show package hierarchy
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Common Tasks
|
|
19
|
-
|
|
20
|
-
**Making code changes:**
|
|
21
|
-
```bash
|
|
22
|
-
1. Edit ABAP file(s)
|
|
23
|
-
2. git add && git commit && git push
|
|
24
|
-
3. abapgit-agent pull --files file.clas.abap
|
|
25
|
-
4. Check for errors in output
|
|
26
|
-
5. If "Error updating where-used list" → use inspect for details
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Exploring unknown tables:**
|
|
30
|
-
```bash
|
|
31
|
-
abapgit-agent preview --objects SFLIGHT # See sample data
|
|
32
|
-
abapgit-agent view --objects SFLIGHT --type TABL # See structure
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Project Structure
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
abapgit-agent/
|
|
39
|
-
├── bin/
|
|
40
|
-
│ └── abapgit-agent # CLI entry point
|
|
41
|
-
├── src/
|
|
42
|
-
│ ├── agent.js # Main agent class
|
|
43
|
-
│ ├── abap-client.js # REST client for ABAP communication
|
|
44
|
-
│ ├── config.js # Configuration management
|
|
45
|
-
│ ├── server.js # HTTP server
|
|
46
|
-
│ └── logger.js # Logging utilities
|
|
47
|
-
├── abap/ # ABAP backend components
|
|
48
|
-
│ ├── zcl_abapgit_agent*.clas.abap # Main agent class
|
|
49
|
-
│ ├── zif_abapgit_agent.intf.abap # Agent interface
|
|
50
|
-
│ ├── zcl_abgagt_cmd_factory.clas.abap # Command factory
|
|
51
|
-
│ ├── zcl_abgagt_command_*.clas.abap # Command implementations
|
|
52
|
-
│ ├── zif_abgagt_command.intf.abap # Command interface
|
|
53
|
-
│ ├── zcl_abgagt_resource_*.clas.abap # REST resource handlers
|
|
54
|
-
│ └── CLAUDE.md # ABAP project guidelines
|
|
55
|
-
└── tests/
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## ABAP Architecture
|
|
59
|
-
|
|
60
|
-
### Call Stack
|
|
61
|
-
```
|
|
62
|
-
CLI (bin/abapgit-agent)
|
|
63
|
-
↓
|
|
64
|
-
REST Client (src/abap-client.js)
|
|
65
|
-
↓
|
|
66
|
-
ABAP REST Handler (ZCL_ABGAGT_REST_HANDLER)
|
|
67
|
-
↓
|
|
68
|
-
Resource: ZCL_ABGAGT_RESOURCE_PULL → ZCL_ABGAGT_CMD_FACTORY → ZCL_ABGAGT_COMMAND_PULL → ZCL_ABGAGT_AGENT
|
|
69
|
-
Resource: ZCL_ABGAGT_RESOURCE_INSPECT → ZCL_ABGAGT_CMD_FACTORY → ZCL_ABGAGT_COMMAND_INSPECT → ZCL_ABGAGT_AGENT
|
|
70
|
-
Resource: ZCL_ABGAGT_RESOURCE_UNIT → ZCL_ABGAGT_CMD_FACTORY → ZCL_ABGAGT_COMMAND_UNIT → ZCL_ABGAGT_AGENT
|
|
71
|
-
Resource: ZCL_ABGAGT_RESOURCE_TREE → ZCL_ABGAGT_CMD_FACTORY → ZCL_ABGAGT_COMMAND_TREE → ZCL_ABGAGT_AGENT
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### ABAP Objects
|
|
75
|
-
|
|
76
|
-
| Object | Description |
|
|
77
|
-
|--------|-------------|
|
|
78
|
-
| `ZCL_ABGAGT_AGENT` | Main agent - handles pull, inspect, unit operations |
|
|
79
|
-
| `ZCL_ABGAGT_CMD_FACTORY` | Command factory - creates command instances dynamically |
|
|
80
|
-
| `ZCL_ABGAGT_COMMAND_PULL` | Pull command - implements ZIF_ABGAGT_COMMAND |
|
|
81
|
-
| `ZCL_ABGAGT_COMMAND_INSPECT` | Inspect command - implements ZIF_ABGAGT_COMMAND |
|
|
82
|
-
| `ZCL_ABGAGT_COMMAND_UNIT` | Unit command - implements ZIF_ABGAGT_COMMAND |
|
|
83
|
-
| `ZCL_ABGAGT_COMMAND_TREE` | Tree command - displays package hierarchy |
|
|
84
|
-
| `ZIF_ABGAGT_COMMAND` | Command interface with constants |
|
|
85
|
-
| `ZIF_ABGAGT_CMD_FACTORY` | Factory interface |
|
|
86
|
-
|
|
87
|
-
## CLI Commands
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Pull and activate from current git repo
|
|
91
|
-
abapgit-agent pull
|
|
92
|
-
|
|
93
|
-
# Pull specific files only (fast - recommended for iterative development)
|
|
94
|
-
abapgit-agent pull --files <file1>,<file2>,...
|
|
95
|
-
|
|
96
|
-
# Pull from specific branch
|
|
97
|
-
abapgit-agent pull --branch <branch>
|
|
98
|
-
|
|
99
|
-
# Pull from specific URL
|
|
100
|
-
abapgit-agent pull --url <git-url>
|
|
101
|
-
|
|
102
|
-
# Syntax check an ABAP file (IMPORTANT for debugging activation errors)
|
|
103
|
-
abapgit-agent inspect --files abap/zcl_my_class.clas.abap
|
|
104
|
-
|
|
105
|
-
# Run unit tests for ABAP test classes
|
|
106
|
-
abapgit-agent unit --files abap/zcl_my_test.clas.testclasses.abap
|
|
107
|
-
|
|
108
|
-
# Display package hierarchy tree
|
|
109
|
-
abapgit-agent tree --package $MY_PACKAGE
|
|
110
|
-
|
|
111
|
-
# View ABAP object definitions from ABAP system
|
|
112
|
-
abapgit-agent view --objects ZCL_MY_CLASS
|
|
113
|
-
abapgit-agent view --objects ZIF_MY_INTERFACE --type INTF
|
|
114
|
-
abapgit-agent view --objects ZCL_CLASS1,ZCL_CLASS2 --json
|
|
115
|
-
|
|
116
|
-
# Preview table/CDS view data
|
|
117
|
-
abapgit-agent preview --objects SFLIGHT
|
|
118
|
-
abapgit-agent preview --objects ZC_MY_CDS_VIEW --type DDLS
|
|
119
|
-
abapgit-agent preview --objects SFLIGHT --columns CARRID,CONNID,PRICE --limit 20
|
|
120
|
-
abapgit-agent preview --objects SFLIGHT --where "CARRID = 'AA'"
|
|
121
|
-
abapgit-agent preview --objects SFLIGHT --vertical
|
|
122
|
-
abapgit-agent preview --objects SFLIGHT --compact
|
|
123
|
-
|
|
124
|
-
# Health check
|
|
125
|
-
abapgit-agent health
|
|
126
|
-
|
|
127
|
-
# Check configuration
|
|
128
|
-
abapgit-agent status
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Pull Command
|
|
132
|
-
|
|
133
|
-
### Description
|
|
134
|
-
Pull and activate ABAP objects from git repository.
|
|
135
|
-
|
|
136
|
-
### Rule: Pull All Changed Files Together
|
|
137
|
-
|
|
138
|
-
**CRITICAL**: When multiple ABAP files are changed, pull them ALL together in a single command:
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
# WRONG - Pull files one by one (may cause activation issues)
|
|
142
|
-
abapgit-agent pull --files zcl_class1.clas.abap
|
|
143
|
-
abapgit-agent pull --files zcl_class2.clas.abap
|
|
144
|
-
abapgit-agent pull --files zif_interface1.intf.abap
|
|
145
|
-
|
|
146
|
-
# CORRECT - Pull all changed files together
|
|
147
|
-
abapgit-agent pull --files zcl_class1.clas.abap,zcl_class2.clas.abap,zif_interface1.intf.abap
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
**Why?** ABAP objects often have dependencies on each other. Pulling separately can cause activation errors if dependent objects haven't been activated yet. Pulling together ensures the ABAP system processes all changes atomically.
|
|
151
|
-
|
|
152
|
-
### Usage
|
|
153
|
-
```bash
|
|
154
|
-
# Auto-detect git remote and branch from current directory
|
|
155
|
-
abapgit-agent pull
|
|
156
|
-
|
|
157
|
-
# Pull specific files only
|
|
158
|
-
abapgit-agent pull --files zcl_my_class.clas.abap,zif_my_intf.intf.abap
|
|
159
|
-
|
|
160
|
-
# Pull from specific branch
|
|
161
|
-
abapgit-agent pull --branch develop
|
|
162
|
-
|
|
163
|
-
# Pull from specific URL (useful for CI/CD)
|
|
164
|
-
abapgit-agent pull --url https://github.com/org/my-repo.git
|
|
165
|
-
|
|
166
|
-
# Combined options
|
|
167
|
-
abapgit-agent pull --branch develop --files src/zcl_my_class.clas.abap
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### File Format
|
|
171
|
-
Files are parsed to extract `(obj_type, obj_name)`:
|
|
172
|
-
- `zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS
|
|
173
|
-
- `zif_my_intf.intf.abap` → INTF, ZIF_MY_INTF
|
|
174
|
-
- `src/zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS (subdirectory support)
|
|
175
|
-
|
|
176
|
-
### Output
|
|
177
|
-
```
|
|
178
|
-
✅ Pull completed successfully!
|
|
179
|
-
Job ID: CAIS20260208115649
|
|
180
|
-
Message: Pull completed successfully
|
|
181
|
-
|
|
182
|
-
📋 Pull Log (N messages):
|
|
183
|
-
───────────────────────────────────────────────────────────────────────────────
|
|
184
|
-
Icon │ Object │ Message
|
|
185
|
-
...
|
|
186
|
-
|
|
187
|
-
📦 Activated Objects (N):
|
|
188
|
-
───────────────────────────────────────────────────────────────────────────────
|
|
189
|
-
✅ CLAS ZCL_MY_CLASS
|
|
190
|
-
...
|
|
191
|
-
|
|
192
|
-
❌ Failed Objects Log (M entries):
|
|
193
|
-
───────────────────────────────────────────────────────────────────────────────
|
|
194
|
-
❌ CLAS ZCL_MY_CLASS: Error message text
|
|
195
|
-
Exception: Exception details
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Key Behaviors
|
|
199
|
-
1. **Activated Objects** - Only includes objects that completed successfully (no errors in log)
|
|
200
|
-
2. **Failed Objects Log** - Shows all error messages (duplicates allowed for multiple errors per object)
|
|
201
|
-
3. **Error Details** - When errors occur, displays error detail section at the top
|
|
202
|
-
|
|
203
|
-
## Health Check
|
|
204
|
-
|
|
205
|
-
### Description
|
|
206
|
-
Check if the ABAP REST API is healthy.
|
|
207
|
-
|
|
208
|
-
### Usage
|
|
209
|
-
```bash
|
|
210
|
-
abapgit-agent health
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### Output
|
|
214
|
-
```json
|
|
215
|
-
{
|
|
216
|
-
"status": "healthy",
|
|
217
|
-
"abap": "connected",
|
|
218
|
-
"version": "1.0.0"
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
## Inspect Command
|
|
223
|
-
|
|
224
|
-
### Description
|
|
225
|
-
Run syntax check for ABAP objects. Supports both regular ABAP objects (classes, interfaces, programs) and CDS views (DDLS).
|
|
226
|
-
|
|
227
|
-
### Usage
|
|
228
|
-
```bash
|
|
229
|
-
# Inspect single file
|
|
230
|
-
abapgit-agent inspect --files abap/zcl_my_class.clas.abap
|
|
231
|
-
|
|
232
|
-
# Inspect multiple files
|
|
233
|
-
abapgit-agent inspect --files abap/zcl_class1.clas.abap,abap/zcl_class2.clas.abap
|
|
234
|
-
|
|
235
|
-
# Inspect CDS view
|
|
236
|
-
abapgit-agent inspect --files abap/zc_my_view.ddls.asddls
|
|
237
|
-
|
|
238
|
-
# Inspect mixed file types (DDLS + CLAS)
|
|
239
|
-
abapgit-agent inspect --files abap/zc_my_view.ddls.asddls,abap/zcl_my_class.clas.abap
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
### Supported Object Types
|
|
243
|
-
|
|
244
|
-
| Type | Description | Validation Method |
|
|
245
|
-
|------|-------------|------------------|
|
|
246
|
-
| CLAS | Class | Code Inspector (SCI) |
|
|
247
|
-
| INTF | Interface | Code Inspector (SCI) |
|
|
248
|
-
| PROG | Program | Code Inspector (SCI) |
|
|
249
|
-
| FUGR | Function Group | Code Inspector (SCI) |
|
|
250
|
-
| DDLS | CDS View/Entity | DDL Handler (CL_DD_DDL_HANDLER_FACTORY) |
|
|
251
|
-
|
|
252
|
-
### Output
|
|
253
|
-
|
|
254
|
-
**Passed:**
|
|
255
|
-
```
|
|
256
|
-
✅ CLAS ZCL_MY_CLASS - Syntax check passed
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
**With Warnings:**
|
|
260
|
-
```
|
|
261
|
-
⚠️ DDLS ZC_MY_VIEW - Syntax check passed with warnings (4):
|
|
262
|
-
|
|
263
|
-
Warnings:
|
|
264
|
-
────────────────────────────────────────────────────────────
|
|
265
|
-
Line 9 : ParentPackage
|
|
266
|
-
Line 11 : SoftwareComponent
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
**Failed:**
|
|
270
|
-
```
|
|
271
|
-
❌ DDLS ZC_MY_VIEW - Syntax check failed (1 error(s)):
|
|
272
|
-
|
|
273
|
-
Errors:
|
|
274
|
-
────────────────────────────────────────────────────────────
|
|
275
|
-
Line 21, Column 12: Error message text
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### Key Behaviors
|
|
279
|
-
|
|
280
|
-
1. **Multiple files in one request** - All files are sent in a single API call for better performance
|
|
281
|
-
2. **CDS View validation** - Uses `CL_DD_DDL_HANDLER_FACTORY` to validate CDS views
|
|
282
|
-
3. **Check inactive version first** - For CDS views, checks the inactive version first (`get_state = 'M'`), then falls back to active version
|
|
283
|
-
4. **Detailed error messages** - Uses `get_errors()` and `get_warnings()` methods from the exception to get detailed information
|
|
284
|
-
5. **Per-object results** - Returns results for each object individually
|
|
285
|
-
|
|
286
|
-
### File Format
|
|
287
|
-
Files are parsed to extract `(obj_type, obj_name)`:
|
|
288
|
-
- `zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS
|
|
289
|
-
- `zc_my_view.ddls.asddls` → DDLS, ZC_MY_VIEW
|
|
290
|
-
|
|
291
|
-
## Unit Command
|
|
292
|
-
|
|
293
|
-
### Description
|
|
294
|
-
Run AUnit tests for ABAP test classes and display detailed results including failed test methods with error messages.
|
|
295
|
-
|
|
296
|
-
### Usage
|
|
297
|
-
```bash
|
|
298
|
-
# Run unit tests for a single test class file
|
|
299
|
-
abapgit-agent unit --files abap/zcl_my_test.clas.testclasses.abap
|
|
300
|
-
|
|
301
|
-
# Run unit tests for multiple test class files
|
|
302
|
-
abapgit-agent unit --files abap/zcl_test1.clas.testclasses.abap,abap/zcl_test2.clas.testclasses.abap
|
|
303
|
-
|
|
304
|
-
# Run unit tests for a specific package
|
|
305
|
-
abapgit-agent unit --package $MY_PACKAGE
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
### File Format
|
|
309
|
-
The command accepts test class files (`.clas.testclasses.abap`):
|
|
310
|
-
- `zcl_my_test.clas.testclasses.abap` → CLAS, ZCL_MY_TEST
|
|
311
|
-
- `src/tests/zcl_my_test.clas.testclasses.abap` → CLAS, ZCL_MY_TEST (with path)
|
|
312
|
-
|
|
313
|
-
### Output
|
|
314
|
-
```
|
|
315
|
-
✅ ZCL_MY_TEST - All tests passed
|
|
316
|
-
Tests: 10 | Passed: 10 | Failed: 0
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
When tests fail:
|
|
320
|
-
```
|
|
321
|
-
❌ ZCL_MY_TEST - Tests failed
|
|
322
|
-
Tests: 10 | Passed: 8 | Failed: 2
|
|
323
|
-
✗ ZCL_MY_TEST=>TEST_METHOD_1: Error description
|
|
324
|
-
✗ ZCL_MY_TEST=>TEST_METHOD_2: Another error
|
|
325
|
-
|
|
326
|
-
Failed Tests:
|
|
327
|
-
────────────────────────────────────────────────────────────────────────────────
|
|
328
|
-
✗ ZCL_MY_TEST=>TEST_METHOD_1
|
|
329
|
-
Error: Expected X but got Y
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### Error Details
|
|
333
|
-
When a test fails, the output includes:
|
|
334
|
-
- **Test Class**: The class containing the failed test
|
|
335
|
-
- **Method**: The failed test method name (with `=>` notation)
|
|
336
|
-
- **Error Kind**: Type of error (e.g., 'ERROR', 'FAILURE')
|
|
337
|
-
- **Error Text**: Detailed error message from AUnit
|
|
338
|
-
|
|
339
|
-
### Response JSON Structure
|
|
340
|
-
```json
|
|
341
|
-
{
|
|
342
|
-
"success": "X",
|
|
343
|
-
"message": "2 of 10 tests failed",
|
|
344
|
-
"test_count": 10,
|
|
345
|
-
"passed_count": 8,
|
|
346
|
-
"failed_count": 2,
|
|
347
|
-
"errors": [
|
|
348
|
-
{
|
|
349
|
-
"class_name": "ZCL_MY_TEST",
|
|
350
|
-
"method_name": "TEST_METHOD_1",
|
|
351
|
-
"error_kind": "ERROR",
|
|
352
|
-
"error_text": "Expected X but got Y"
|
|
353
|
-
}
|
|
354
|
-
]
|
|
355
|
-
}
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
### Implementation
|
|
359
|
-
The unit command uses `CL_SUT_AUNIT_RUNNER` to execute AUnit tests:
|
|
360
|
-
- `CL_SUT_AUNIT_RUNNER=>S_CREATE` - Create test runner
|
|
361
|
-
- `run()` - Execute tests
|
|
362
|
-
- `str_results` - Get test statistics (cnt_testmethods, cnt_ok_methods, cnt_error_methods)
|
|
363
|
-
- `tab_objects` - Get detailed results with nested structure:
|
|
364
|
-
- `TAB_TESTCLASSES` → `TAB_METHODS` → `STR_ERROR` → `STR_ERROR_CORE`
|
|
365
|
-
|
|
366
|
-
## Tree Command
|
|
367
|
-
|
|
368
|
-
### Description
|
|
369
|
-
Display the package hierarchy tree from an ABAP system, showing parent packages, sub-packages, and object counts.
|
|
370
|
-
|
|
371
|
-
### Usage
|
|
372
|
-
```bash
|
|
373
|
-
# Basic usage
|
|
374
|
-
abapgit-agent tree --package $MY_PACKAGE
|
|
375
|
-
|
|
376
|
-
# With object breakdown by type
|
|
377
|
-
abapgit-agent tree --package $MY_PACKAGE --include-objects
|
|
378
|
-
|
|
379
|
-
# Limit depth (default: 3, max: 10)
|
|
380
|
-
abapgit-agent tree --package $MY_PACKAGE --depth 2
|
|
381
|
-
|
|
382
|
-
# JSON output for scripting
|
|
383
|
-
abapgit-agent tree --package $MY_PACKAGE --json
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
### Parameters
|
|
387
|
-
|
|
388
|
-
| Parameter | Required | Description |
|
|
389
|
-
|-----------|----------|-------------|
|
|
390
|
-
| `--package` | Yes | ABAP package name (e.g., `$ZMY_PACKAGE`, `ZMY_PACKAGE`) |
|
|
391
|
-
| `--depth` | No | Maximum depth to traverse (default: 3, max: 10) |
|
|
392
|
-
| `--include-objects` | No | Include object counts breakdown by type |
|
|
393
|
-
| `--json` | No | Output raw JSON only (for scripting) |
|
|
394
|
-
|
|
395
|
-
### Output
|
|
396
|
-
|
|
397
|
-
**Human-readable with AI metadata:**
|
|
398
|
-
```
|
|
399
|
-
🌳 Package Tree: $ZMAIN_PACKAGE
|
|
400
|
-
|
|
401
|
-
📦 $ZMAIN_PACKAGE (Main Package)
|
|
402
|
-
├─ 📦 $ZMAIN_SUB1 (Sub Package 1)
|
|
403
|
-
│ ├─ 📦 $ZMAIN_SUB1_A (Sub Package 1A)
|
|
404
|
-
│ └─ 📦 $ZMAIN_SUB1_B (Sub Package 1B)
|
|
405
|
-
└─ 📦 $ZMAIN_SUB2 (Sub Package 2)
|
|
406
|
-
|
|
407
|
-
📊 Summary
|
|
408
|
-
PACKAGES: 4
|
|
409
|
-
OBJECTS: 127
|
|
410
|
-
|
|
411
|
-
<!-- AI_METADATA_START -->
|
|
412
|
-
{"package":"$ZMAIN_PACKAGE","parent":"$ZSAP_BASE","total_packages":4,"total_objects":127}
|
|
413
|
-
<!-- AI_METADATA_END -->
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
**With object breakdown:**
|
|
417
|
-
```
|
|
418
|
-
📊 Summary
|
|
419
|
-
PACKAGES: 4
|
|
420
|
-
OBJECTS: 127
|
|
421
|
-
TYPES: CLAS=10 INTF=2 PROG=11 FUGR=1 TABL=3
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### JSON Output
|
|
425
|
-
```json
|
|
426
|
-
{
|
|
427
|
-
"SUCCESS": true,
|
|
428
|
-
"COMMAND": "TREE",
|
|
429
|
-
"PACKAGE": "$ZMAIN_PACKAGE",
|
|
430
|
-
"PARENT_PACKAGE": "$ZSAP_BASE",
|
|
431
|
-
"NODES": [
|
|
432
|
-
{
|
|
433
|
-
"PACKAGE": "$ZMAIN_PACKAGE",
|
|
434
|
-
"PARENT": "",
|
|
435
|
-
"DESCRIPTION": "$ZMAIN_PACKAGE",
|
|
436
|
-
"DEPTH": 0,
|
|
437
|
-
"OBJECT_COUNT": 11
|
|
438
|
-
}
|
|
439
|
-
],
|
|
440
|
-
"TOTAL_PACKAGES": 4,
|
|
441
|
-
"TOTAL_OBJECTS": 127,
|
|
442
|
-
"OBJECTS": [
|
|
443
|
-
{ "OBJECT": "CLAS", "COUNT": 10 },
|
|
444
|
-
{ "OBJECT": "INTF", "COUNT": 2 },
|
|
445
|
-
{ "OBJECT": "PROG", "COUNT": 11 },
|
|
446
|
-
{ "OBJECT": "FUGR", "COUNT": 1 },
|
|
447
|
-
{ "OBJECT": "TABL", "COUNT": 3 }
|
|
448
|
-
],
|
|
449
|
-
"ERROR": ""
|
|
450
|
-
}
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
### Error Handling
|
|
454
|
-
|
|
455
|
-
| Error | Message |
|
|
456
|
-
|-------|---------|
|
|
457
|
-
| Package not found | `Package <name> does not exist in the system` |
|
|
458
|
-
| Invalid package name | `Invalid package name: <name>` |
|
|
459
|
-
| Access denied | `Access denied to package information` |
|
|
460
|
-
| Depth too large | `Depth value too large (max: 10)` |
|
|
461
|
-
|
|
462
|
-
## View Command
|
|
463
|
-
|
|
464
|
-
### Description
|
|
465
|
-
View ABAP object definitions directly from the ABAP system without pulling from git. **This is the PRIMARY way to explore unfamiliar ABAP objects** - tables, structures, classes, interfaces, and data elements.
|
|
466
|
-
|
|
467
|
-
**When you encounter an unknown table or structure, use this command instead of guessing!**
|
|
468
|
-
|
|
469
|
-
### Explore Unknown Tables/Structures
|
|
470
|
-
|
|
471
|
-
```bash
|
|
472
|
-
# View table fields - see all columns, keys, and descriptions
|
|
473
|
-
abapgit-agent view --objects ZMY_TABLE --type TABL
|
|
474
|
-
|
|
475
|
-
# View structure components
|
|
476
|
-
abapgit-agent view --objects ZMY_STRUCT --type STRU
|
|
477
|
-
|
|
478
|
-
# View data element type information
|
|
479
|
-
abapgit-agent view --objects ZMY_DTEL --type DTEL
|
|
480
|
-
|
|
481
|
-
# View CDS view definition
|
|
482
|
-
abapgit-agent view --objects ZC_MY_CDS_VIEW --type DDLS
|
|
483
|
-
|
|
484
|
-
# View class interface and methods
|
|
485
|
-
abapgit-agent view --objects ZCL_UNKNOWN_CLASS
|
|
486
|
-
|
|
487
|
-
# View interface definition
|
|
488
|
-
abapgit-agent view --objects ZIF_UNKNOWN_INTERFACE
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
### When to Use View Command
|
|
492
|
-
|
|
493
|
-
AI assistant SHOULD call `view` command when:
|
|
494
|
-
|
|
495
|
-
- User asks to "check", "look up", or "explore" an unfamiliar object
|
|
496
|
-
- Working with a table/structure and you don't know the field names/types
|
|
497
|
-
- Calling a class/interface method and you don't know the parameters
|
|
498
|
-
- User provides an object name that may not exist in the git repository
|
|
499
|
-
- You need to verify an object exists before using it
|
|
500
|
-
|
|
501
|
-
**Example workflow:**
|
|
502
|
-
```
|
|
503
|
-
User: "Check if SFLIGHT table has a PRICE field"
|
|
504
|
-
|
|
505
|
-
Assistant: <calls `abapgit-agent view --objects SFLIGHT --type TABL`>
|
|
506
|
-
→ Shows table structure with all fields including PRICE
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
### Usage
|
|
510
|
-
```bash
|
|
511
|
-
# View single object (auto-detect type from TADIR)
|
|
512
|
-
abapgit-agent view --objects ZCL_MY_CLASS
|
|
513
|
-
abapgit-agent view --objects ZIF_MY_INTERFACE
|
|
514
|
-
|
|
515
|
-
# View with explicit type
|
|
516
|
-
abapgit-agent view --objects ZCL_MY_CLASS --type CLAS
|
|
517
|
-
abapgit-agent view --objects ZIF_MY_INT --type INTF
|
|
518
|
-
abapgit-agent view --objects ZMY_TABLE --type TABL
|
|
519
|
-
|
|
520
|
-
# View multiple objects
|
|
521
|
-
abapgit-agent view --objects ZCL_CLASS1,ZCL_CLASS2,ZIF_INTERFACE1
|
|
522
|
-
|
|
523
|
-
# JSON output (for scripting/AI processing)
|
|
524
|
-
abapgit-agent view --objects ZCL_MY_CLASS --json
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
### Parameters
|
|
528
|
-
|
|
529
|
-
| Parameter | Required | Description |
|
|
530
|
-
|-----------|----------|-------------|
|
|
531
|
-
| `--objects` | Yes | Comma-separated list of object names (e.g., `ZCL_MY_CLASS,ZIF_MY_INTERFACE`) |
|
|
532
|
-
| `--type` | No | Object type (CLAS, INTF, TABL, STRU, DTEL, TTYP, DDLS). Auto-detected from TADIR if not specified |
|
|
533
|
-
| `--json` | No | Output raw JSON only (for scripting) |
|
|
534
|
-
|
|
535
|
-
### Supported Object Types
|
|
536
|
-
|
|
537
|
-
| Type | Description |
|
|
538
|
-
|------|-------------|
|
|
539
|
-
| CLAS | Class |
|
|
540
|
-
| INTF | Interface |
|
|
541
|
-
| TABL | Table |
|
|
542
|
-
| STRU | Structure |
|
|
543
|
-
| DTEL | Data Element |
|
|
544
|
-
| TTYP | Table Type |
|
|
545
|
-
| DDLS | CDS View/Entity |
|
|
546
|
-
|
|
547
|
-
**Note:** Object type is automatically detected from TADIR. Use `--type` only when you know the type and want to override auto-detection.
|
|
548
|
-
|
|
549
|
-
### Output
|
|
550
|
-
|
|
551
|
-
**Human-readable:**
|
|
552
|
-
```
|
|
553
|
-
📖 ZCL_MY_CLASS (Class)
|
|
554
|
-
Class ZCL_MY_CLASS in $PACKAGE
|
|
555
|
-
|
|
556
|
-
CLASS zcl_my_class DEFINITION PUBLIC.
|
|
557
|
-
|
|
558
|
-
PUBLIC SECTION.
|
|
559
|
-
INTERFACES: zif_my_interface.
|
|
560
|
-
METHODS: constructor,
|
|
561
|
-
get_value RETURNING VALUE(rv_result) TYPE string.
|
|
562
|
-
ENDCLASS.
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
**JSON Output:**
|
|
566
|
-
```json
|
|
567
|
-
{
|
|
568
|
-
"success": true,
|
|
569
|
-
"command": "VIEW",
|
|
570
|
-
"message": "Retrieved object(s)",
|
|
571
|
-
"objects": [
|
|
572
|
-
{
|
|
573
|
-
"name": "ZCL_MY_CLASS",
|
|
574
|
-
"type": "CLAS",
|
|
575
|
-
"type_text": "Class",
|
|
576
|
-
"description": "Class ZCL_MY_CLASS in $PACKAGE",
|
|
577
|
-
"source": "CLASS zcl_my_class DEFINITION PUBLIC...",
|
|
578
|
-
"not_found": false
|
|
579
|
-
}
|
|
580
|
-
],
|
|
581
|
-
"summary": { "total": 1 }
|
|
582
|
-
}
|
|
583
|
-
```
|
|
584
|
-
|
|
585
|
-
**Table Type Output:**
|
|
586
|
-
```
|
|
587
|
-
📖 ZMY_TTYP (Table Type)
|
|
588
|
-
Table Type ZMY_TTYP in $PACKAGE
|
|
589
|
-
|
|
590
|
-
Line Type: ZMY_STRUCTURE
|
|
591
|
-
Access Mode: STANDARD
|
|
592
|
-
Key Definition: WITH KEY
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
**CDS View Output:**
|
|
596
|
-
```
|
|
597
|
-
📖 ZC_MY_CDS_VIEW (CDS View)
|
|
598
|
-
CDS View ZC_MY_CDS_VIEW in $PACKAGE
|
|
599
|
-
|
|
600
|
-
@AbapCatalog.sqlViewName: 'ZCMYVIEW'
|
|
601
|
-
@AbapCatalog.compiler.compareFilter: true
|
|
602
|
-
@AccessControl.authorizationCheck: #NOT_REQUIRED
|
|
603
|
-
@EndUserText.label: 'My CDS View'
|
|
604
|
-
define view ZC_MY_CDS_VIEW as select from tdevc
|
|
605
|
-
{
|
|
606
|
-
key devclass as Devclass,
|
|
607
|
-
parentcl as ParentPackage,
|
|
608
|
-
ctext as Description
|
|
609
|
-
}
|
|
610
|
-
where devclass not like '$%'
|
|
611
|
-
```
|
|
612
|
-
|
|
613
|
-
### Error Handling
|
|
614
|
-
|
|
615
|
-
| Error | Message |
|
|
616
|
-
|-------|---------|
|
|
617
|
-
| Object not found | `Object <name> not found` |
|
|
618
|
-
| Invalid object type | `Unsupported object type: <type>` |
|
|
619
|
-
|
|
620
|
-
## Preview Command
|
|
621
|
-
|
|
622
|
-
### Description
|
|
623
|
-
Preview data from ABAP tables or CDS views directly from the ABAP system. This command retrieves sample data rows to help developers understand table/view contents without needing to query manually.
|
|
624
|
-
|
|
625
|
-
**This is the PRIMARY way to explore table and CDS view DATA.**
|
|
626
|
-
|
|
627
|
-
### Usage
|
|
628
|
-
```bash
|
|
629
|
-
# Preview table data (auto-detect type)
|
|
630
|
-
abapgit-agent preview --objects SFLIGHT
|
|
631
|
-
|
|
632
|
-
# Preview CDS view data
|
|
633
|
-
abapgit-agent preview --objects ZC_MY_CDS_VIEW --type DDLS
|
|
634
|
-
|
|
635
|
-
# Preview with explicit type
|
|
636
|
-
abapgit-agent preview --objects SFLIGHT --type TABL
|
|
637
|
-
|
|
638
|
-
# Preview with row limit
|
|
639
|
-
abapgit-agent preview --objects SFLIGHT --limit 20
|
|
640
|
-
|
|
641
|
-
# Preview with WHERE clause filter
|
|
642
|
-
abapgit-agent preview --objects SFLIGHT --where "CARRID = 'AA'"
|
|
643
|
-
|
|
644
|
-
# Preview specific columns only
|
|
645
|
-
abapgit-agent preview --objects SFLIGHT --columns CARRID,CONNID,FLDATE,PRICE
|
|
646
|
-
|
|
647
|
-
# Vertical format (for wide tables)
|
|
648
|
-
abapgit-agent preview --objects SFLIGHT --vertical
|
|
649
|
-
|
|
650
|
-
# JSON output (for scripting/AI processing)
|
|
651
|
-
abapgit-agent preview --objects SFLIGHT --json
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
### Parameters
|
|
655
|
-
|
|
656
|
-
| Parameter | Required | Description |
|
|
657
|
-
|-----------|----------|-------------|
|
|
658
|
-
| `--objects` | Yes | Comma-separated list of table/view names |
|
|
659
|
-
| `--type` | No | Object type (TABL, DDLS). Auto-detected from TADIR if not specified |
|
|
660
|
-
| `--limit` | No | Maximum rows to return (default: 10, max: 100) |
|
|
661
|
-
| `--where` | No | WHERE clause filter (e.g., `CARRID = 'AA'`) |
|
|
662
|
-
| `--columns` | No | Comma-separated column names to display |
|
|
663
|
-
| `--vertical` | No | Show data in vertical format (one field per line) |
|
|
664
|
-
| `--compact` | No | Truncate values to fit columns |
|
|
665
|
-
| `--json` | No | Output raw JSON only |
|
|
666
|
-
|
|
667
|
-
### Output
|
|
668
|
-
|
|
669
|
-
**Default (first 6 columns shown with indicator):**
|
|
670
|
-
```
|
|
671
|
-
📊 Preview: SFLIGHT (Table)
|
|
672
|
-
|
|
673
|
-
┌──────────┬────────┬──────────┬───────────┬─────────┬─────────┐
|
|
674
|
-
│ CARRID │ CONNID │ FLDATE │ PRICE │ CURRENCY│ PLANETYPE│
|
|
675
|
-
├──────────┼────────┼──────────┼───────────┼─────────┼─────────┤
|
|
676
|
-
│ AA │ 0017 │ 20240201 │ 422.94 │ USD │ 747-400 │
|
|
677
|
-
│ AA │ 0017 │ 20240202 │ 422.94 │ USD │ 747-400 │
|
|
678
|
-
└──────────┴────────┴──────────┴───────────┴─────────┴─────────┘
|
|
679
|
-
|
|
680
|
-
Showing 2 of 10 rows
|
|
681
|
-
⚠️ Note: 3 more columns hidden (SEATSMAX, SEATSOCC, PAYMENTSUM)
|
|
682
|
-
Use --columns to select specific columns
|
|
683
|
-
Use --json for full data
|
|
684
|
-
```
|
|
685
|
-
|
|
686
|
-
**With WHERE Filter:**
|
|
687
|
-
```
|
|
688
|
-
📊 Preview: SFLIGHT (filtered)
|
|
689
|
-
|
|
690
|
-
┌──────────┬────────┬──────────┬─────────┐
|
|
691
|
-
│ CARRID │ CONNID │ FLDATE │ PRICE │
|
|
692
|
-
├──────────┼────────┼──────────┼─────────┤
|
|
693
|
-
│ AA │ 0017 │ 20240201 │ 422.94 │
|
|
694
|
-
│ AA │ 0017 │ 20240202 │ 422.94 │
|
|
695
|
-
└──────────┴────────┴──────────┴─────────┘
|
|
696
|
-
|
|
697
|
-
WHERE: CARRID = 'AA'
|
|
698
|
-
```
|
|
699
|
-
|
|
700
|
-
**Vertical Format (for wide tables):**
|
|
701
|
-
```
|
|
702
|
-
📊 Preview: SFLIGHT (1 of 10 rows, vertical)
|
|
703
|
-
|
|
704
|
-
Row 1:
|
|
705
|
-
────────────────────────────────────────────────────────────
|
|
706
|
-
CARRID: AA
|
|
707
|
-
CONNID: 0017
|
|
708
|
-
FLDATE: 20240201
|
|
709
|
-
PRICE: 422.94
|
|
710
|
-
CURRENCY: USD
|
|
711
|
-
PLANETYPE: 747-400
|
|
712
|
-
SEATSMAX: 400
|
|
713
|
-
SEATSOCC: 350
|
|
714
|
-
PAYMENTSUM: 145000
|
|
715
|
-
────────────────────────────────────────────────────────────
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
### JSON Output
|
|
719
|
-
```json
|
|
720
|
-
{
|
|
721
|
-
"SUCCESS": true,
|
|
722
|
-
"COMMAND": "PREVIEW",
|
|
723
|
-
"OBJECTS": [
|
|
724
|
-
{
|
|
725
|
-
"NAME": "SFLIGHT",
|
|
726
|
-
"TYPE": "TABL",
|
|
727
|
-
"TYPE_TEXT": "Table",
|
|
728
|
-
"ROW_COUNT": 2,
|
|
729
|
-
"TOTAL_ROWS": 10,
|
|
730
|
-
"ROWS": [
|
|
731
|
-
{ "CARRID": "AA", "CONNID": "0017", "FLDATE": "20240201", "PRICE": "422.94", ... }
|
|
732
|
-
],
|
|
733
|
-
"FIELDS": [
|
|
734
|
-
{ "FIELD": "CARRID", "TYPE": "CHAR", "LENGTH": 3 },
|
|
735
|
-
{ "FIELD": "PRICE", "TYPE": "CURR", "LENGTH": 16 }
|
|
736
|
-
],
|
|
737
|
-
"COLUMNS_DISPLAYED": 6,
|
|
738
|
-
"COLUMNS_HIDDEN": ["SEATSMAX", "SEATSOCC", "PAYMENTSUM"]
|
|
739
|
-
}
|
|
740
|
-
],
|
|
741
|
-
"SUMMARY": { "TOTAL_OBJECTS": 1, "TOTAL_ROWS": 2 },
|
|
742
|
-
"ERROR": ""
|
|
743
|
-
}
|
|
744
|
-
```
|
|
745
|
-
|
|
746
|
-
### Error Handling
|
|
747
|
-
|
|
748
|
-
| Error | Message |
|
|
749
|
-
|-------|---------|
|
|
750
|
-
| Table not found | `Table not found: Z_NONEXISTENT` |
|
|
751
|
-
| CDS View not found | `CDS View not found: Z_NONEXISTENT` |
|
|
752
|
-
| Access denied | `Access denied to table: SFLIGHT` |
|
|
753
|
-
| Invalid WHERE clause | `Invalid WHERE clause: <reason>` |
|
|
754
|
-
|
|
755
|
-
### Auto-Detection Rules
|
|
756
|
-
|
|
757
|
-
| Object Name Pattern | Default Type |
|
|
758
|
-
|---------------------|--------------|
|
|
759
|
-
| `ZC_*` or `zc_*` | DDLS (CDS View) |
|
|
760
|
-
| Other | TABL (Table) |
|
|
761
|
-
|
|
762
|
-
## Status Check
|
|
763
|
-
|
|
764
|
-
### Description
|
|
765
|
-
Check if ABAP integration is configured for the current repository.
|
|
766
|
-
|
|
767
|
-
### Usage
|
|
768
|
-
```bash
|
|
769
|
-
abapgit-agent status
|
|
770
|
-
```
|
|
771
|
-
|
|
772
|
-
### Output
|
|
773
|
-
```
|
|
774
|
-
✅ ABAP Git Agent is ENABLED
|
|
775
|
-
Config location: /path/to/repo/.abapGitAgent
|
|
776
|
-
```
|
|
777
|
-
|
|
778
|
-
Or if not configured:
|
|
779
|
-
```
|
|
780
|
-
❌ ABAP Git Agent is NOT configured
|
|
781
|
-
```
|
|
782
|
-
|
|
783
|
-
## Configuration
|
|
784
|
-
|
|
785
|
-
### File-based (.abapGitAgent)
|
|
786
|
-
Create `.abapGitAgent` in repository root:
|
|
787
|
-
```json
|
|
788
|
-
{
|
|
789
|
-
"host": "your-sap-system.com",
|
|
790
|
-
"sapport": 443,
|
|
791
|
-
"client": "100",
|
|
792
|
-
"user": "TECH_USER",
|
|
793
|
-
"password": "your-password",
|
|
794
|
-
"language": "EN",
|
|
795
|
-
"gitUsername": "git-username",
|
|
796
|
-
"gitPassword": "git-token"
|
|
797
|
-
}
|
|
798
|
-
```
|
|
799
|
-
|
|
800
|
-
### Configuration Options
|
|
801
|
-
|
|
802
|
-
| Option | Description | Default |
|
|
803
|
-
|--------|-------------|---------|
|
|
804
|
-
| `host` | SAP system hostname | Required |
|
|
805
|
-
| `sapport` | SAP port (usually 443) | 443 |
|
|
806
|
-
| `client` | SAP client number | 100 |
|
|
807
|
-
| `user` | SAP username | Required |
|
|
808
|
-
| `password` | SAP password | Required |
|
|
809
|
-
| `language` | SAP language | EN |
|
|
810
|
-
| `gitUsername` | Git username/token | Optional |
|
|
811
|
-
| `gitPassword` | Git password/token | Optional |
|
|
812
|
-
|
|
813
|
-
### Environment Variables
|
|
814
|
-
```bash
|
|
815
|
-
export ABAP_HOST="your-sap-system.com"
|
|
816
|
-
export ABAP_PORT=443
|
|
817
|
-
export ABAP_CLIENT="100"
|
|
818
|
-
export ABAP_USER="TECH_USER"
|
|
819
|
-
export ABAP_PASSWORD="your-password"
|
|
820
|
-
export ABAP_LANGUAGE="EN"
|
|
821
|
-
export GIT_USERNAME="git-username"
|
|
822
|
-
export GIT_PASSWORD="git-token"
|
|
823
|
-
```
|
|
824
|
-
|
|
825
|
-
## Troubleshooting
|
|
826
|
-
|
|
827
|
-
**Pull fails with "Error updating where-used list":**
|
|
828
|
-
- This means SYNTAX ERROR in the object
|
|
829
|
-
- Run `abapgit-agent inspect --files <file>` for detailed errors
|
|
830
|
-
|
|
831
|
-
**Pull shows "Failed Objects" > 0:**
|
|
832
|
-
- Objects failed to activate - check the error messages
|
|
833
|
-
- Fix syntax errors and pull again
|
|
834
|
-
|
|
835
|
-
**Preview/View command fails:**
|
|
836
|
-
- Check table/view exists in the ABAP system
|
|
837
|
-
- Verify credentials in `.abapGitAgent`
|
|
838
|
-
|
|
839
|
-
**"Table or view not found":**
|
|
840
|
-
- Table may not exist or may have different name
|
|
841
|
-
- Use `view` command to check available tables
|
|
842
|
-
|
|
843
|
-
**Terminal width issues with preview:**
|
|
844
|
-
- Use `--columns` to specify exact columns
|
|
845
|
-
- Use `--vertical` for wide tables
|
|
846
|
-
|
|
847
|
-
## Development Workflow
|
|
848
|
-
|
|
849
|
-
### Exploring Unknown ABAP Objects
|
|
850
|
-
|
|
851
|
-
**Check package structure:**
|
|
852
|
-
```bash
|
|
853
|
-
abapgit-agent tree --package $MY_PACKAGE
|
|
854
|
-
```
|
|
855
|
-
|
|
856
|
-
**Before working with an unfamiliar table, structure, class, or interface:**
|
|
857
|
-
|
|
858
|
-
```bash
|
|
859
|
-
# Don't guess! Use view command to explore:
|
|
860
|
-
|
|
861
|
-
# Check table structure
|
|
862
|
-
abapgit-agent view --objects ZMY_TABLE --type TABL
|
|
863
|
-
|
|
864
|
-
# Check structure components
|
|
865
|
-
abapgit-agent view --objects ZMY_STRUCT --type STRU
|
|
866
|
-
|
|
867
|
-
# Check class methods and interface
|
|
868
|
-
abapgit-agent view --objects ZCL_UNKNOWN_CLASS
|
|
869
|
-
|
|
870
|
-
# Check interface definition
|
|
871
|
-
abapgit-agent view --objects ZIF_UNKNOWN_INTERFACE
|
|
872
|
-
|
|
873
|
-
# Check data element type
|
|
874
|
-
abapgit-agent view --objects ZMY_DTEL --type DTEL
|
|
875
|
-
|
|
876
|
-
# JSON output for programmatic use
|
|
877
|
-
abapgit-agent view --objects ZMY_TABLE --type TABL --json
|
|
878
|
-
```
|
|
879
|
-
|
|
880
|
-
### CLI Tool Development
|
|
881
|
-
|
|
882
|
-
1. Make changes to CLI code (JavaScript)
|
|
883
|
-
2. Test locally: `node bin/abapgit-agent pull`
|
|
884
|
-
3. Test against real ABAP system
|
|
885
|
-
4. Commit and push
|
|
886
|
-
|
|
887
|
-
### ABAP Backend Development
|
|
888
|
-
|
|
889
|
-
1. Make changes to ABAP backend (abap/ folder)
|
|
890
|
-
2. Pull only changed files (faster):
|
|
891
|
-
```bash
|
|
892
|
-
abapgit-agent pull --files abap/zcl_my_class.clas.abap
|
|
893
|
-
```
|
|
894
|
-
Or pull all files:
|
|
895
|
-
```bash
|
|
896
|
-
abapgit-agent pull
|
|
897
|
-
```
|
|
898
|
-
3. Commit and push
|
|
899
|
-
4. Deploy changes via abapGit to your SAP system
|
|
900
|
-
|
|
901
|
-
### Fast Iteration Workflow
|
|
902
|
-
|
|
903
|
-
For quick ABAP code changes:
|
|
904
|
-
1. Make small change to ABAP file
|
|
905
|
-
2. `git add <file> && git commit -m "fix"`
|
|
906
|
-
3. `abapgit-agent pull --files <file>` (seconds, not minutes)
|
|
907
|
-
4. Verify activation results
|
|
908
|
-
5. Repeat until done
|
|
909
|
-
|
|
910
|
-
## Creating CDS Views
|
|
911
|
-
|
|
912
|
-
For guidelines on creating CDS views and CDS view entities, see **ABAP Code Generation** below.
|
|
913
|
-
|
|
914
|
-
## For ABAP Code Generation
|
|
915
|
-
|
|
916
|
-
**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.
|
|
917
|
-
|
|
918
|
-
## ABAP Unit Tests
|
|
919
|
-
|
|
920
|
-
### File Structure
|
|
921
|
-
- Main class: `zcl_xxx.clas.abap`
|
|
922
|
-
- Test class: `zcl_xxx.clas.testclasses.abap`
|
|
923
|
-
- No separate XML needed for test classes
|
|
924
|
-
|
|
925
|
-
### XML Configuration
|
|
926
|
-
Add `<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>` to main class XML file:
|
|
927
|
-
```xml
|
|
928
|
-
<VSEOCLASS>
|
|
929
|
-
<CLSNAME>ZCL_ABGAGT_UTIL</CLSNAME>
|
|
930
|
-
...
|
|
931
|
-
<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
|
|
932
|
-
</VSEOCLASS>
|
|
933
|
-
```
|
|
934
|
-
|
|
935
|
-
### Test Class Naming
|
|
936
|
-
- Short name: `ltcl_<name>` (e.g., `ltcl_util`, not `ltcl_abgagt_util_test`)
|
|
937
|
-
- Must include `FINAL` keyword
|
|
938
|
-
- **CRITICAL: Class name MUST NOT exceed 30 characters!**
|
|
939
|
-
- Example: `ltcl_cmd_inspect` (18 chars) is OK
|
|
940
|
-
- `ltcl_zcl_abgagt_command_infect` (32 chars) is NOT OK
|
|
941
|
-
|
|
942
|
-
### Test Class Declaration
|
|
943
|
-
```abap
|
|
944
|
-
CLASS ltcl_util DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
|
|
945
|
-
```
|
|
946
|
-
|
|
947
|
-
### Test Methods
|
|
948
|
-
- Must have `FOR TESTING` keyword
|
|
949
|
-
- Can optionally include `RAISING <exception>`
|
|
950
|
-
- **CRITICAL: Method names MUST NOT exceed 30 characters!**
|
|
951
|
-
- Example: `test_exec_multi_files` (20 chars) is OK
|
|
952
|
-
- `test_exec_multiple_files` (25 chars) is OK
|
|
953
|
-
- `test_exec_multiple_files_with_long_name` (40 chars) is NOT OK
|
|
954
|
-
|
|
955
|
-
### Setup Method
|
|
956
|
-
```abap
|
|
957
|
-
METHOD setup.
|
|
958
|
-
mo_util = zcl_abgagt_util=>get_instance( ).
|
|
959
|
-
ENDMETHOD.
|
|
960
|
-
```
|
|
961
|
-
|
|
962
|
-
### Assertions
|
|
963
|
-
Use `CL_ABAP_UNIT_ASSERT` class:
|
|
964
|
-
- `assert_equals( act = lv_act exp = lv_exp msg = 'message' )`
|
|
965
|
-
- `assert_initial( act = lv_act msg = 'message' )`
|
|
966
|
-
- `assert_not_initial( act = lv_act msg = 'message' )`
|
|
967
|
-
|
|
968
|
-
### Method Call Format
|
|
969
|
-
- Instance methods: `mo_object->method( )`
|
|
970
|
-
- Class/static methods: `zcl_class=>method( )`
|
|
971
|
-
|
|
972
|
-
### DATA() vs VALUE #() Rule
|
|
973
|
-
**When assigning to a typed variable, ABAP can infer the type from the target.**
|
|
974
|
-
|
|
975
|
-
**CORRECT:**
|
|
976
|
-
```abap
|
|
977
|
-
" When target has explicit type, VALUE #() infers from it
|
|
978
|
-
DATA lt_so_class TYPE RANGE OF seoaliases-clsname.
|
|
979
|
-
lt_so_class = VALUE #( ( sign = 'I' option = 'EQ' low = lv_value ) ).
|
|
980
|
-
|
|
981
|
-
" Or append with inline VALUE
|
|
982
|
-
APPEND VALUE #( sign = 'I' option = 'EQ' low = lv_value ) TO lt_so_class.
|
|
983
|
-
```
|
|
984
|
-
|
|
985
|
-
**WRONG (untyped variable):**
|
|
986
|
-
```abap
|
|
987
|
-
DATA(ls_range) = VALUE #( sign = 'I' option = 'EQ' low = lv_value ). " Type unknown!
|
|
988
|
-
```
|
|
989
|
-
|
|
990
|
-
### Example Test Class
|
|
991
|
-
```abap
|
|
992
|
-
*----------------------------------------------------------------------*
|
|
993
|
-
* CLASS ltcl_util DEFINITION
|
|
994
|
-
*----------------------------------------------------------------------*
|
|
995
|
-
CLASS ltcl_util DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
|
|
996
|
-
|
|
997
|
-
PRIVATE SECTION.
|
|
998
|
-
METHODS setup.
|
|
999
|
-
DATA mo_util TYPE REF TO zcl_abgagt_util.
|
|
1000
|
-
|
|
1001
|
-
METHODS parse_class_file FOR TESTING.
|
|
1002
|
-
|
|
1003
|
-
ENDCLASS.
|
|
1004
|
-
|
|
1005
|
-
*----------------------------------------------------------------------*
|
|
1006
|
-
* CLASS ltcl_util IMPLEMENTATION
|
|
1007
|
-
*----------------------------------------------------------------------*
|
|
1008
|
-
CLASS ltcl_util IMPLEMENTATION.
|
|
1009
|
-
|
|
1010
|
-
METHOD setup.
|
|
1011
|
-
mo_util = zcl_abgagt_util=>get_instance( ).
|
|
1012
|
-
ENDMETHOD.
|
|
1013
|
-
|
|
1014
|
-
METHOD parse_class_file.
|
|
1015
|
-
DATA lv_file TYPE string VALUE 'zcl_my_class.clas.abap'.
|
|
1016
|
-
DATA lv_obj_type TYPE string.
|
|
1017
|
-
DATA lv_obj_name TYPE string.
|
|
1018
|
-
|
|
1019
|
-
mo_util->zif_abgagt_util~parse_file_to_object(
|
|
1020
|
-
EXPORTING iv_file = lv_file
|
|
1021
|
-
IMPORTING ev_obj_type = lv_obj_type
|
|
1022
|
-
ev_obj_name = lv_obj_name ).
|
|
1023
|
-
|
|
1024
|
-
cl_abap_unit_assert=>assert_equals(
|
|
1025
|
-
act = lv_obj_type
|
|
1026
|
-
exp = 'CLAS'
|
|
1027
|
-
msg = 'Object type should be CLAS' ).
|
|
1028
|
-
ENDMETHOD.
|
|
1029
|
-
|
|
1030
|
-
ENDCLASS.
|
|
1031
|
-
```
|