abapgit-agent 1.2.0 → 1.4.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,9 @@ 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 |
15
+ | POST | `/preview` | Preview table/CDS view data |
13
16
 
14
17
  ## GET /health
15
18
 
@@ -222,7 +225,375 @@ The endpoint parses file names to extract `obj_type` and `obj_name`, then runs A
222
225
  }
223
226
  ```
224
227
 
225
- ## Response Structure
228
+ ## POST /tree
229
+
230
+ Display package hierarchy tree from ABAP system.
231
+
232
+ ### Request Body
233
+
234
+ ```json
235
+ {
236
+ "package": "$MY_PACKAGE",
237
+ "depth": 3,
238
+ "include_objects": true
239
+ }
240
+ ```
241
+
242
+ | Field | Type | Description |
243
+ |-------|------|-------------|
244
+ | `package` | String | Package name (required) |
245
+ | `depth` | Integer | Maximum depth (default: 3, max: 10) |
246
+ | `include_objects` | Boolean | Include object counts by type |
247
+
248
+ ### Response (success)
249
+
250
+ ```json
251
+ {
252
+ "success": true,
253
+ "command": "TREE",
254
+ "package": "$MY_PACKAGE",
255
+ "message": "Tree retrieved successfully",
256
+ "parent_package": "$ZSAP_BASE",
257
+ "nodes": [
258
+ {
259
+ "package": "$MY_PACKAGE",
260
+ "parent": "",
261
+ "description": "$MY_PACKAGE",
262
+ "depth": 0,
263
+ "object_count": 10
264
+ },
265
+ {
266
+ "package": "$MY_SUBPACKAGE",
267
+ "parent": "$MY_PACKAGE",
268
+ "description": "$MY_SUBPACKAGE",
269
+ "depth": 1,
270
+ "object_count": 5
271
+ }
272
+ ],
273
+ "total_packages": 2,
274
+ "total_objects": 15,
275
+ "objects": [
276
+ { "object": "CLAS", "count": 8 },
277
+ { "object": "INTF", "count": 2 },
278
+ { "object": "TABL", "count": 5 }
279
+ ],
280
+ "error": ""
281
+ }
282
+ ```
283
+
284
+ ### Response (error)
285
+
286
+ ```json
287
+ {
288
+ "success": false,
289
+ "command": "TREE",
290
+ "package": "$NONEXISTENT",
291
+ "error": "Package $NONEXISTENT does not exist"
292
+ }
293
+ ```
294
+
295
+ ## POST /view
296
+
297
+ View ABAP object definitions directly from ABAP system.
298
+
299
+ ### Request Body
300
+
301
+ ```json
302
+ {
303
+ "objects": ["ZCL_MY_CLASS", "ZIF_MY_INTERFACE", "SFLIGHT"],
304
+ "type": "CLAS"
305
+ }
306
+ ```
307
+
308
+ | Field | Type | Description |
309
+ |-------|------|-------------|
310
+ | `objects` | Array | List of object names (required) |
311
+ | `type` | String | Object type (CLAS, INTF, TABL, STRU, DTEL). Auto-detected if not specified |
312
+
313
+ ### Supported Object Types
314
+
315
+ | Type | Description |
316
+ |------|-------------|
317
+ | CLAS | Global ABAP class |
318
+ | INTF | Global interface |
319
+ | TABL | Database table |
320
+ | STRU | Structure type |
321
+ | DTEL | Data element |
322
+
323
+ ### Response (success - class/interface)
324
+
325
+ ```json
326
+ {
327
+ "success": true,
328
+ "command": "VIEW",
329
+ "message": "Retrieved object(s)",
330
+ "objects": [
331
+ {
332
+ "name": "ZCL_MY_CLASS",
333
+ "type": "CLAS",
334
+ "type_text": "Class",
335
+ "description": "Class ZCL_MY_CLASS in $PACKAGE",
336
+ "source": "CLASS zcl_my_class DEFINITION PUBLIC.\n PUBLIC SECTION.\n ...",
337
+ "not_found": false,
338
+ "components": []
339
+ }
340
+ ],
341
+ "summary": {
342
+ "total": 1,
343
+ "by_type": ["CLAS"]
344
+ },
345
+ "error": ""
346
+ }
347
+ ```
348
+
349
+ ### Response (success - table)
350
+
351
+ ```json
352
+ {
353
+ "success": true,
354
+ "command": "VIEW",
355
+ "message": "Retrieved object(s)",
356
+ "objects": [
357
+ {
358
+ "name": "SFLIGHT",
359
+ "type": "TABL",
360
+ "type_text": "Table",
361
+ "description": "Table SFLIGHT in SAPBC_DATAMODEL",
362
+ "source": "",
363
+ "not_found": false,
364
+ "components": [
365
+ {
366
+ "field": "MANDT",
367
+ "key": true,
368
+ "type": "CLNT",
369
+ "length": 3,
370
+ "dataelement": "MANDT",
371
+ "description": "Client"
372
+ },
373
+ {
374
+ "field": "CARRID",
375
+ "key": true,
376
+ "type": "CHAR",
377
+ "length": 3,
378
+ "dataelement": "S_CARR_ID",
379
+ "description": "Airline Code"
380
+ }
381
+ ]
382
+ }
383
+ ],
384
+ "summary": {
385
+ "total": 1,
386
+ "by_type": ["TABL"]
387
+ },
388
+ "error": ""
389
+ }
390
+ ```
391
+
392
+ ### Response (success - data element)
393
+
394
+ ```json
395
+ {
396
+ "success": true,
397
+ "command": "VIEW",
398
+ "message": "Retrieved object(s)",
399
+ "objects": [
400
+ {
401
+ "name": "S_CARR_ID",
402
+ "type": "DTEL",
403
+ "type_text": "Data Element",
404
+ "description": "Airline Code",
405
+ "domain": "S_CARR_ID",
406
+ "domain_type": "CHAR",
407
+ "domain_length": 3,
408
+ "domain_decimals": 0,
409
+ "not_found": false,
410
+ "components": []
411
+ }
412
+ ],
413
+ "summary": {
414
+ "total": 1,
415
+ "by_type": ["DTEL"]
416
+ },
417
+ "error": ""
418
+ }
419
+ ```
420
+
421
+ ### Response (not found)
422
+
423
+ ```json
424
+ {
425
+ "success": true,
426
+ "command": "VIEW",
427
+ "message": "Retrieved object(s)",
428
+ "objects": [
429
+ {
430
+ "name": "ZIF_NONEXISTENT",
431
+ "type": "",
432
+ "type_text": "Unknown",
433
+ "not_found": true,
434
+ "components": []
435
+ }
436
+ ],
437
+ "summary": {
438
+ "total": 1,
439
+ "by_type": [""]
440
+ },
441
+ "error": ""
442
+ }
443
+ ```
444
+
445
+ ## POST /preview
446
+
447
+ Preview data from ABAP tables or CDS views directly from the ABAP system. This is useful for exploring table/view contents without writing queries.
448
+
449
+ ### Request Body
450
+
451
+ ```json
452
+ {
453
+ "objects": ["SFLIGHT", "ZC_MY_CDS_VIEW"],
454
+ "type": "TABL",
455
+ "limit": 10,
456
+ "where": "CARRID = 'AA'",
457
+ "columns": ["CARRID", "CONNID", "PRICE"]
458
+ }
459
+ ```
460
+
461
+ | Field | Type | Description |
462
+ |-------|------|-------------|
463
+ | `objects` | Array | List of table/view names (required) |
464
+ | `type` | String | Object type (TABL, DDLS). Auto-detected if not specified |
465
+ | `limit` | Integer | Maximum rows to return (default: 10, max: 100) |
466
+ | `where` | String | WHERE clause filter (e.g., `CARRID = 'AA'`) |
467
+ | `columns` | Array | Column names to display (optional) |
468
+
469
+ ### Supported Object Types
470
+
471
+ | Type | Description |
472
+ |------|-------------|
473
+ | TABL | Database table |
474
+ | DDLS | CDS View/Entity |
475
+
476
+ ### Auto-Detection Rules
477
+
478
+ If `type` is not specified, the system detects the type from TADIR:
479
+ - CDS views (DDLS) are preferred if found in TADIR
480
+ - Otherwise defaults to table (TABL)
481
+
482
+ ### Response (success - table)
483
+
484
+ ```json
485
+ {
486
+ "success": true,
487
+ "command": "PREVIEW",
488
+ "message": "Retrieved data",
489
+ "objects": [
490
+ {
491
+ "name": "SFLIGHT",
492
+ "type": "TABL",
493
+ "type_text": "Table",
494
+ "row_count": 5,
495
+ "total_rows": 10,
496
+ "rows": [
497
+ {
498
+ "MANDT": "100",
499
+ "CARRID": "AA",
500
+ "CONNID": 17,
501
+ "FLDATE": "2024-10-24",
502
+ "PRICE": 422.94,
503
+ "CURRENCY": "USD",
504
+ "PLANETYPE": "747-400"
505
+ }
506
+ ],
507
+ "fields": [
508
+ { "field": "MANDT", "type": "CLNT", "length": 3 },
509
+ { "field": "CARRID", "type": "CHAR", "length": 3 },
510
+ { "field": "CONNID", "type": "NUMC", "length": 4 },
511
+ { "field": "FLDATE", "type": "DATS", "length": 8 },
512
+ { "field": "PRICE", "type": "CURR", "length": 16, "decimals": 2 },
513
+ { "field": "CURRENCY", "type": "CUKY", "length": 5 }
514
+ ],
515
+ "columns_displayed": 6,
516
+ "columns_hidden": ["SEATSMAX", "SEATSOCC", "PAYMENTSUM"],
517
+ "error": ""
518
+ }
519
+ ],
520
+ "summary": {
521
+ "total_objects": 1,
522
+ "total_rows": 5
523
+ },
524
+ "error": ""
525
+ }
526
+ ```
527
+
528
+ ### Response (success - CDS view)
529
+
530
+ ```json
531
+ {
532
+ "success": true,
533
+ "command": "PREVIEW",
534
+ "message": "Retrieved data",
535
+ "objects": [
536
+ {
537
+ "name": "ZC_MY_CDS_VIEW",
538
+ "type": "DDLS",
539
+ "type_text": "CDS View",
540
+ "row_count": 10,
541
+ "total_rows": 25,
542
+ "rows": [
543
+ {
544
+ "PACKAGE": "ZMY_PACKAGE",
545
+ "DESCRIPTION": "My Package",
546
+ "PARENT": "$ZROOT"
547
+ }
548
+ ],
549
+ "fields": [
550
+ { "field": "PACKAGE", "type": "CHAR", "length": 30 },
551
+ { "field": "DESCRIPTION", "type": "CHAR", "length": 60 },
552
+ { "field": "PARENT", "type": "CHAR", "length": 30 }
553
+ ],
554
+ "columns_displayed": 3,
555
+ "columns_hidden": [],
556
+ "error": ""
557
+ }
558
+ ],
559
+ "summary": {
560
+ "total_objects": 1,
561
+ "total_rows": 10
562
+ },
563
+ "error": ""
564
+ }
565
+ ```
566
+
567
+ ### Response (error - not found)
568
+
569
+ ```json
570
+ {
571
+ "success": true,
572
+ "command": "PREVIEW",
573
+ "message": "Retrieved data",
574
+ "objects": [
575
+ {
576
+ "name": "Z_NONEXISTENT",
577
+ "type": "TABL",
578
+ "type_text": "Table",
579
+ "row_count": 0,
580
+ "total_rows": 0,
581
+ "rows": [],
582
+ "fields": [],
583
+ "columns_displayed": 0,
584
+ "columns_hidden": [],
585
+ "error": "Table or view not found: Z_NONEXISTENT"
586
+ }
587
+ ],
588
+ "summary": {
589
+ "total_objects": 1,
590
+ "total_rows": 0
591
+ },
592
+ "error": ""
593
+ }
594
+ ```
595
+
596
+ ### Response Structure
226
597
 
227
598
  ### Pull Response Fields
228
599
 
@@ -261,6 +632,74 @@ The endpoint parses file names to extract `obj_type` and `obj_name`, then runs A
261
632
  | `message` | String | Status message |
262
633
  | `errors` | Array | Failed test details (empty if all tests pass) |
263
634
 
635
+ ### Tree Response Fields
636
+
637
+ | Field | Type | Description |
638
+ |-------|------|-------------|
639
+ | `success` | Boolean | Whether the request succeeded |
640
+ | `command` | String | Command name ("TREE") |
641
+ | `package` | String | Root package name |
642
+ | `message` | String | Status message |
643
+ | `parent_package` | String | Parent package (empty if root) |
644
+ | `nodes` | Array | Flat list of all packages |
645
+ | `total_packages` | Integer | Total packages in tree |
646
+ | `total_objects` | Integer | Total objects in tree |
647
+ | `objects` | Array | Object counts by type |
648
+ | `error` | String | Error message (empty if success) |
649
+
650
+ ### View Response Fields
651
+
652
+ | Field | Type | Description |
653
+ |-------|------|-------------|
654
+ | `success` | Boolean | Whether the request succeeded |
655
+ | `command` | String | Command name ("VIEW") |
656
+ | `message` | String | Status message |
657
+ | `objects` | Array | List of object information |
658
+ | `summary` | Object | Summary with total and by_type |
659
+ | `error` | String | Error message (empty if success) |
660
+
661
+ ### Preview Response Fields
662
+
663
+ | Field | Type | Description |
664
+ |-------|------|-------------|
665
+ | `success` | Boolean | Whether the request succeeded |
666
+ | `command` | String | Command name ("PREVIEW") |
667
+ | `message` | String | Status message |
668
+ | `objects` | Array | List of table/view results |
669
+ | `summary` | Object | Summary with total_objects and total_rows |
670
+ | `error` | String | Error message (empty if success) |
671
+
672
+ ### Preview Object Fields
673
+
674
+ | Field | Type | Description |
675
+ |-------|------|-------------|
676
+ | `name` | String | Table/view name |
677
+ | `type` | String | Object type (TABL, DDLS) |
678
+ | `type_text` | String | Human-readable type (Table, CDS View) |
679
+ | `row_count` | Integer | Number of rows returned |
680
+ | `total_rows` | Integer | Total rows available (before limit) |
681
+ | `rows` | Array | Array of row objects with field:value pairs |
682
+ | `fields` | Array | Field metadata (field, type, length, decimals) |
683
+ | `columns_displayed` | Integer | Number of columns in output |
684
+ | `columns_hidden` | Array | Column names not displayed (if limited) |
685
+ | `error` | String | Error message (empty if success) |
686
+
687
+ ### Object Fields (for View)
688
+
689
+ | Field | Type | Description |
690
+ |-------|------|-------------|
691
+ | `name` | String | Object name |
692
+ | `type` | String | Object type (CLAS, INTF, TABL, STRU, DTEL) |
693
+ | `type_text` | String | Human-readable type |
694
+ | `description` | String | Object description |
695
+ | `source` | String | Source code (CLAS/INTF) |
696
+ | `domain` | String | Domain name (DTEL) |
697
+ | `domain_type` | String | Domain data type (DTEL) |
698
+ | `domain_length` | Integer | Domain length (DTEL) |
699
+ | `domain_decimals` | Integer | Domain decimals (DTEL) |
700
+ | `not_found` | Boolean | true if object does not exist |
701
+ | `components` | Array | Fields/components (TABL/STRU) |
702
+
264
703
  ### Error Item Fields
265
704
 
266
705
  | Field | Type | Description |