abapgit-agent 1.2.0 → 1.3.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/API.md CHANGED
@@ -10,6 +10,8 @@ The ABAP system exposes these endpoints via SICF handler: `sap/bc/z_abapgit_agen
10
10
  | POST | `/pull` | Pull and activate repository |
11
11
  | POST | `/inspect` | Inspect source file for issues |
12
12
  | POST | `/unit` | Execute unit tests (AUnit) |
13
+ | POST | `/tree` | Display package hierarchy tree |
14
+ | POST | `/view` | View ABAP object definitions |
13
15
 
14
16
  ## GET /health
15
17
 
@@ -222,6 +224,223 @@ The endpoint parses file names to extract `obj_type` and `obj_name`, then runs A
222
224
  }
223
225
  ```
224
226
 
227
+ ## POST /tree
228
+
229
+ Display package hierarchy tree from ABAP system.
230
+
231
+ ### Request Body
232
+
233
+ ```json
234
+ {
235
+ "package": "$MY_PACKAGE",
236
+ "depth": 3,
237
+ "include_objects": true
238
+ }
239
+ ```
240
+
241
+ | Field | Type | Description |
242
+ |-------|------|-------------|
243
+ | `package` | String | Package name (required) |
244
+ | `depth` | Integer | Maximum depth (default: 3, max: 10) |
245
+ | `include_objects` | Boolean | Include object counts by type |
246
+
247
+ ### Response (success)
248
+
249
+ ```json
250
+ {
251
+ "success": true,
252
+ "command": "TREE",
253
+ "package": "$MY_PACKAGE",
254
+ "message": "Tree retrieved successfully",
255
+ "parent_package": "$ZSAP_BASE",
256
+ "nodes": [
257
+ {
258
+ "package": "$MY_PACKAGE",
259
+ "parent": "",
260
+ "description": "$MY_PACKAGE",
261
+ "depth": 0,
262
+ "object_count": 10
263
+ },
264
+ {
265
+ "package": "$MY_SUBPACKAGE",
266
+ "parent": "$MY_PACKAGE",
267
+ "description": "$MY_SUBPACKAGE",
268
+ "depth": 1,
269
+ "object_count": 5
270
+ }
271
+ ],
272
+ "total_packages": 2,
273
+ "total_objects": 15,
274
+ "objects": [
275
+ { "object": "CLAS", "count": 8 },
276
+ { "object": "INTF", "count": 2 },
277
+ { "object": "TABL", "count": 5 }
278
+ ],
279
+ "error": ""
280
+ }
281
+ ```
282
+
283
+ ### Response (error)
284
+
285
+ ```json
286
+ {
287
+ "success": false,
288
+ "command": "TREE",
289
+ "package": "$NONEXISTENT",
290
+ "error": "Package $NONEXISTENT does not exist"
291
+ }
292
+ ```
293
+
294
+ ## POST /view
295
+
296
+ View ABAP object definitions directly from ABAP system.
297
+
298
+ ### Request Body
299
+
300
+ ```json
301
+ {
302
+ "objects": ["ZCL_MY_CLASS", "ZIF_MY_INTERFACE", "SFLIGHT"],
303
+ "type": "CLAS"
304
+ }
305
+ ```
306
+
307
+ | Field | Type | Description |
308
+ |-------|------|-------------|
309
+ | `objects` | Array | List of object names (required) |
310
+ | `type` | String | Object type (CLAS, INTF, TABL, STRU, DTEL). Auto-detected if not specified |
311
+
312
+ ### Supported Object Types
313
+
314
+ | Type | Description |
315
+ |------|-------------|
316
+ | CLAS | Global ABAP class |
317
+ | INTF | Global interface |
318
+ | TABL | Database table |
319
+ | STRU | Structure type |
320
+ | DTEL | Data element |
321
+
322
+ ### Response (success - class/interface)
323
+
324
+ ```json
325
+ {
326
+ "success": true,
327
+ "command": "VIEW",
328
+ "message": "Retrieved object(s)",
329
+ "objects": [
330
+ {
331
+ "name": "ZCL_MY_CLASS",
332
+ "type": "CLAS",
333
+ "type_text": "Class",
334
+ "description": "Class ZCL_MY_CLASS in $PACKAGE",
335
+ "source": "CLASS zcl_my_class DEFINITION PUBLIC.\n PUBLIC SECTION.\n ...",
336
+ "not_found": false,
337
+ "components": []
338
+ }
339
+ ],
340
+ "summary": {
341
+ "total": 1,
342
+ "by_type": ["CLAS"]
343
+ },
344
+ "error": ""
345
+ }
346
+ ```
347
+
348
+ ### Response (success - table)
349
+
350
+ ```json
351
+ {
352
+ "success": true,
353
+ "command": "VIEW",
354
+ "message": "Retrieved object(s)",
355
+ "objects": [
356
+ {
357
+ "name": "SFLIGHT",
358
+ "type": "TABL",
359
+ "type_text": "Table",
360
+ "description": "Table SFLIGHT in SAPBC_DATAMODEL",
361
+ "source": "",
362
+ "not_found": false,
363
+ "components": [
364
+ {
365
+ "field": "MANDT",
366
+ "key": true,
367
+ "type": "CLNT",
368
+ "length": 3,
369
+ "dataelement": "MANDT",
370
+ "description": "Client"
371
+ },
372
+ {
373
+ "field": "CARRID",
374
+ "key": true,
375
+ "type": "CHAR",
376
+ "length": 3,
377
+ "dataelement": "S_CARR_ID",
378
+ "description": "Airline Code"
379
+ }
380
+ ]
381
+ }
382
+ ],
383
+ "summary": {
384
+ "total": 1,
385
+ "by_type": ["TABL"]
386
+ },
387
+ "error": ""
388
+ }
389
+ ```
390
+
391
+ ### Response (success - data element)
392
+
393
+ ```json
394
+ {
395
+ "success": true,
396
+ "command": "VIEW",
397
+ "message": "Retrieved object(s)",
398
+ "objects": [
399
+ {
400
+ "name": "S_CARR_ID",
401
+ "type": "DTEL",
402
+ "type_text": "Data Element",
403
+ "description": "Airline Code",
404
+ "domain": "S_CARR_ID",
405
+ "domain_type": "CHAR",
406
+ "domain_length": 3,
407
+ "domain_decimals": 0,
408
+ "not_found": false,
409
+ "components": []
410
+ }
411
+ ],
412
+ "summary": {
413
+ "total": 1,
414
+ "by_type": ["DTEL"]
415
+ },
416
+ "error": ""
417
+ }
418
+ ```
419
+
420
+ ### Response (not found)
421
+
422
+ ```json
423
+ {
424
+ "success": true,
425
+ "command": "VIEW",
426
+ "message": "Retrieved object(s)",
427
+ "objects": [
428
+ {
429
+ "name": "ZIF_NONEXISTENT",
430
+ "type": "",
431
+ "type_text": "Unknown",
432
+ "not_found": true,
433
+ "components": []
434
+ }
435
+ ],
436
+ "summary": {
437
+ "total": 1,
438
+ "by_type": [""]
439
+ },
440
+ "error": ""
441
+ }
442
+ ```
443
+
225
444
  ## Response Structure
226
445
 
227
446
  ### Pull Response Fields
@@ -261,6 +480,48 @@ The endpoint parses file names to extract `obj_type` and `obj_name`, then runs A
261
480
  | `message` | String | Status message |
262
481
  | `errors` | Array | Failed test details (empty if all tests pass) |
263
482
 
483
+ ### Tree Response Fields
484
+
485
+ | Field | Type | Description |
486
+ |-------|------|-------------|
487
+ | `success` | Boolean | Whether the request succeeded |
488
+ | `command` | String | Command name ("TREE") |
489
+ | `package` | String | Root package name |
490
+ | `message` | String | Status message |
491
+ | `parent_package` | String | Parent package (empty if root) |
492
+ | `nodes` | Array | Flat list of all packages |
493
+ | `total_packages` | Integer | Total packages in tree |
494
+ | `total_objects` | Integer | Total objects in tree |
495
+ | `objects` | Array | Object counts by type |
496
+ | `error` | String | Error message (empty if success) |
497
+
498
+ ### View Response Fields
499
+
500
+ | Field | Type | Description |
501
+ |-------|------|-------------|
502
+ | `success` | Boolean | Whether the request succeeded |
503
+ | `command` | String | Command name ("VIEW") |
504
+ | `message` | String | Status message |
505
+ | `objects` | Array | List of object information |
506
+ | `summary` | Object | Summary with total and by_type |
507
+ | `error` | String | Error message (empty if success) |
508
+
509
+ ### Object Fields (for View)
510
+
511
+ | Field | Type | Description |
512
+ |-------|------|-------------|
513
+ | `name` | String | Object name |
514
+ | `type` | String | Object type (CLAS, INTF, TABL, STRU, DTEL) |
515
+ | `type_text` | String | Human-readable type |
516
+ | `description` | String | Object description |
517
+ | `source` | String | Source code (CLAS/INTF) |
518
+ | `domain` | String | Domain name (DTEL) |
519
+ | `domain_type` | String | Domain data type (DTEL) |
520
+ | `domain_length` | Integer | Domain length (DTEL) |
521
+ | `domain_decimals` | Integer | Domain decimals (DTEL) |
522
+ | `not_found` | Boolean | true if object does not exist |
523
+ | `components` | Array | Fields/components (TABL/STRU) |
524
+
264
525
  ### Error Item Fields
265
526
 
266
527
  | Field | Type | Description |
package/CLAUDE.md CHANGED
@@ -181,6 +181,75 @@ abapgit-agent health
181
181
  }
182
182
  ```
183
183
 
184
+ ## Inspect Command
185
+
186
+ ### Description
187
+ Run syntax check for ABAP objects. Supports both regular ABAP objects (classes, interfaces, programs) and CDS views (DDLS).
188
+
189
+ ### Usage
190
+ ```bash
191
+ # Inspect single file
192
+ abapgit-agent inspect --files abap/zcl_my_class.clas.abap
193
+
194
+ # Inspect multiple files
195
+ abapgit-agent inspect --files abap/zcl_class1.clas.abap,abap/zcl_class2.clas.abap
196
+
197
+ # Inspect CDS view
198
+ abapgit-agent inspect --files abap/zc_my_view.ddls.asddls
199
+
200
+ # Inspect mixed file types (DDLS + CLAS)
201
+ abapgit-agent inspect --files abap/zc_my_view.ddls.asddls,abap/zcl_my_class.clas.abap
202
+ ```
203
+
204
+ ### Supported Object Types
205
+
206
+ | Type | Description | Validation Method |
207
+ |------|-------------|------------------|
208
+ | CLAS | Class | Code Inspector (SCI) |
209
+ | INTF | Interface | Code Inspector (SCI) |
210
+ | PROG | Program | Code Inspector (SCI) |
211
+ | FUGR | Function Group | Code Inspector (SCI) |
212
+ | DDLS | CDS View/Entity | DDL Handler (CL_DD_DDL_HANDLER_FACTORY) |
213
+
214
+ ### Output
215
+
216
+ **Passed:**
217
+ ```
218
+ ✅ CLAS ZCL_MY_CLASS - Syntax check passed
219
+ ```
220
+
221
+ **With Warnings:**
222
+ ```
223
+ ⚠️ DDLS ZC_MY_VIEW - Syntax check passed with warnings (4):
224
+
225
+ Warnings:
226
+ ────────────────────────────────────────────────────────────
227
+ Line 9 : ParentPackage
228
+ Line 11 : SoftwareComponent
229
+ ```
230
+
231
+ **Failed:**
232
+ ```
233
+ ❌ DDLS ZC_MY_VIEW - Syntax check failed (1 error(s)):
234
+
235
+ Errors:
236
+ ────────────────────────────────────────────────────────────
237
+ Line 21, Column 12: Error message text
238
+ ```
239
+
240
+ ### Key Behaviors
241
+
242
+ 1. **Multiple files in one request** - All files are sent in a single API call for better performance
243
+ 2. **CDS View validation** - Uses `CL_DD_DDL_HANDLER_FACTORY` to validate CDS views
244
+ 3. **Check inactive version first** - For CDS views, checks the inactive version first (`get_state = 'M'`), then falls back to active version
245
+ 4. **Detailed error messages** - Uses `get_errors()` and `get_warnings()` methods from the exception to get detailed information
246
+ 5. **Per-object results** - Returns results for each object individually
247
+
248
+ ### File Format
249
+ Files are parsed to extract `(obj_type, obj_name)`:
250
+ - `zcl_my_class.clas.abap` → CLAS, ZCL_MY_CLASS
251
+ - `zc_my_view.ddls.asddls` → DDLS, ZC_MY_VIEW
252
+
184
253
  ## Unit Command
185
254
 
186
255
  ### Description
@@ -371,6 +440,9 @@ abapgit-agent view --objects ZMY_STRUCT --type STRU
371
440
  # View data element type information
372
441
  abapgit-agent view --objects ZMY_DTEL --type DTEL
373
442
 
443
+ # View CDS view definition
444
+ abapgit-agent view --objects ZC_MY_CDS_VIEW --type DDLS
445
+
374
446
  # View class interface and methods
375
447
  abapgit-agent view --objects ZCL_UNKNOWN_CLASS
376
448
 
@@ -378,6 +450,24 @@ abapgit-agent view --objects ZCL_UNKNOWN_CLASS
378
450
  abapgit-agent view --objects ZIF_UNKNOWN_INTERFACE
379
451
  ```
380
452
 
453
+ ### When to Use View Command
454
+
455
+ AI assistant SHOULD call `view` command when:
456
+
457
+ - User asks to "check", "look up", or "explore" an unfamiliar object
458
+ - Working with a table/structure and you don't know the field names/types
459
+ - Calling a class/interface method and you don't know the parameters
460
+ - User provides an object name that may not exist in the git repository
461
+ - You need to verify an object exists before using it
462
+
463
+ **Example workflow:**
464
+ ```
465
+ User: "Check if SFLIGHT table has a PRICE field"
466
+
467
+ Assistant: <calls `abapgit-agent view --objects SFLIGHT --type TABL`>
468
+ → Shows table structure with all fields including PRICE
469
+ ```
470
+
381
471
  ### Usage
382
472
  ```bash
383
473
  # View single object (auto-detect type from TADIR)
@@ -401,29 +491,37 @@ abapgit-agent view --objects ZCL_MY_CLASS --json
401
491
  | Parameter | Required | Description |
402
492
  |-----------|----------|-------------|
403
493
  | `--objects` | Yes | Comma-separated list of object names (e.g., `ZCL_MY_CLASS,ZIF_MY_INTERFACE`) |
404
- | `--type` | No | Object type for all objects (CLAS, INTF, TABL, STRU, DTEL, FUGR, PROG). Auto-detected from name prefix if not specified |
494
+ | `--type` | No | Object type (CLAS, INTF, TABL, STRU, DTEL, TTYP, DDLS). Auto-detected from TADIR if not specified |
405
495
  | `--json` | No | Output raw JSON only (for scripting) |
406
496
 
407
497
  ### Supported Object Types
408
498
 
409
- | Type | Description | Detection Pattern |
410
- |------|-------------|-------------------|
411
- | CLAS | Class | ZCL_* |
412
- | INTF | Interface | ZIF_* |
413
- | TABL | Table | Z* (from DD02L) |
414
- | STRU | Structure | Z* (from DD02L) |
415
- | DTEL | Data Element | ZTY_*, ZS_* |
499
+ | Type | Description |
500
+ |------|-------------|
501
+ | CLAS | Class |
502
+ | INTF | Interface |
503
+ | TABL | Table |
504
+ | STRU | Structure |
505
+ | DTEL | Data Element |
506
+ | TTYP | Table Type |
507
+ | DDLS | CDS View/Entity |
508
+
509
+ **Note:** Object type is automatically detected from TADIR. Use `--type` only when you know the type and want to override auto-detection.
416
510
 
417
511
  ### Output
418
512
 
419
513
  **Human-readable:**
420
514
  ```
421
515
  📖 ZCL_MY_CLASS (Class)
422
- My Custom Configuration Class
423
- Methods: 3
424
- - PUBLIC CONSTRUCTOR
425
- - PUBLIC GET_CONFIG
426
- - PUBLIC SET_CONFIG
516
+ Class ZCL_MY_CLASS in $PACKAGE
517
+
518
+ CLASS zcl_my_class DEFINITION PUBLIC.
519
+
520
+ PUBLIC SECTION.
521
+ INTERFACES: zif_my_interface.
522
+ METHODS: constructor,
523
+ get_value RETURNING VALUE(rv_result) TYPE string.
524
+ ENDCLASS.
427
525
  ```
428
526
 
429
527
  **JSON Output:**
@@ -431,20 +529,49 @@ abapgit-agent view --objects ZCL_MY_CLASS --json
431
529
  {
432
530
  "success": true,
433
531
  "command": "VIEW",
434
- "message": "Retrieved 1 object(s)",
532
+ "message": "Retrieved object(s)",
435
533
  "objects": [
436
534
  {
437
535
  "name": "ZCL_MY_CLASS",
438
536
  "type": "CLAS",
439
537
  "type_text": "Class",
440
- "description": "My Custom Configuration Class",
441
- "methods": [...]
538
+ "description": "Class ZCL_MY_CLASS in $PACKAGE",
539
+ "source": "CLASS zcl_my_class DEFINITION PUBLIC...",
540
+ "not_found": false
442
541
  }
443
542
  ],
444
543
  "summary": { "total": 1 }
445
544
  }
446
545
  ```
447
546
 
547
+ **Table Type Output:**
548
+ ```
549
+ 📖 ZMY_TTYP (Table Type)
550
+ Table Type ZMY_TTYP in $PACKAGE
551
+
552
+ Line Type: ZMY_STRUCTURE
553
+ Access Mode: STANDARD
554
+ Key Definition: WITH KEY
555
+ ```
556
+
557
+ **CDS View Output:**
558
+ ```
559
+ 📖 ZC_MY_CDS_VIEW (CDS View)
560
+ CDS View ZC_MY_CDS_VIEW in $PACKAGE
561
+
562
+ @AbapCatalog.sqlViewName: 'ZCMYVIEW'
563
+ @AbapCatalog.compiler.compareFilter: true
564
+ @AccessControl.authorizationCheck: #NOT_REQUIRED
565
+ @EndUserText.label: 'My CDS View'
566
+ define view ZC_MY_CDS_VIEW as select from tdevc
567
+ {
568
+ key devclass as Devclass,
569
+ parentcl as ParentPackage,
570
+ ctext as Description
571
+ }
572
+ where devclass not like '$%'
573
+ ```
574
+
448
575
  ### Error Handling
449
576
 
450
577
  | Error | Message |
@@ -519,6 +646,11 @@ export GIT_PASSWORD="git-token"
519
646
 
520
647
  ### Exploring Unknown ABAP Objects
521
648
 
649
+ **Check package structure:**
650
+ ```bash
651
+ abapgit-agent tree --package $MY_PACKAGE
652
+ ```
653
+
522
654
  **Before working with an unfamiliar table, structure, class, or interface:**
523
655
 
524
656
  ```bash
@@ -573,6 +705,10 @@ For quick ABAP code changes:
573
705
  4. Verify activation results
574
706
  5. Repeat until done
575
707
 
708
+ ## Creating CDS Views
709
+
710
+ For guidelines on creating CDS views and CDS view entities, see **ABAP Code Generation** below.
711
+
576
712
  ## For ABAP Code Generation
577
713
 
578
714
  **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.
package/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Release Notes
2
2
 
3
+ ## v1.3.0
4
+
5
+ ### New Features
6
+
7
+ - **view Command**: Now supports TTYP (Table Type) and DDLS (CDS View)
8
+
9
+ ### Bug Fixes
10
+
11
+ - Fixed CDS view source display in view command
12
+ - Fixed interface exception handling
13
+
14
+ ---
15
+
3
16
  ## v1.2.0
4
17
 
5
18
  ### New Features