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.
Files changed (53) hide show
  1. package/.abapGitAgent.example +11 -0
  2. package/API.md +271 -0
  3. package/CLAUDE.md +445 -0
  4. package/CLAUDE_MEM.md +88 -0
  5. package/ERROR_HANDLING.md +30 -0
  6. package/INSTALL.md +160 -0
  7. package/README.md +127 -0
  8. package/abap/CLAUDE.md +492 -0
  9. package/abap/package.devc.xml +10 -0
  10. package/abap/zcl_abgagt_agent.clas.abap +769 -0
  11. package/abap/zcl_abgagt_agent.clas.xml +15 -0
  12. package/abap/zcl_abgagt_cmd_factory.clas.abap +43 -0
  13. package/abap/zcl_abgagt_cmd_factory.clas.xml +15 -0
  14. package/abap/zcl_abgagt_command_inspect.clas.abap +192 -0
  15. package/abap/zcl_abgagt_command_inspect.clas.testclasses.abap +121 -0
  16. package/abap/zcl_abgagt_command_inspect.clas.xml +16 -0
  17. package/abap/zcl_abgagt_command_pull.clas.abap +80 -0
  18. package/abap/zcl_abgagt_command_pull.clas.testclasses.abap +87 -0
  19. package/abap/zcl_abgagt_command_pull.clas.xml +16 -0
  20. package/abap/zcl_abgagt_command_unit.clas.abap +297 -0
  21. package/abap/zcl_abgagt_command_unit.clas.xml +15 -0
  22. package/abap/zcl_abgagt_resource_health.clas.abap +25 -0
  23. package/abap/zcl_abgagt_resource_health.clas.xml +15 -0
  24. package/abap/zcl_abgagt_resource_inspect.clas.abap +62 -0
  25. package/abap/zcl_abgagt_resource_inspect.clas.xml +15 -0
  26. package/abap/zcl_abgagt_resource_pull.clas.abap +71 -0
  27. package/abap/zcl_abgagt_resource_pull.clas.xml +15 -0
  28. package/abap/zcl_abgagt_resource_unit.clas.abap +64 -0
  29. package/abap/zcl_abgagt_resource_unit.clas.xml +15 -0
  30. package/abap/zcl_abgagt_rest_handler.clas.abap +27 -0
  31. package/abap/zcl_abgagt_rest_handler.clas.xml +15 -0
  32. package/abap/zcl_abgagt_util.clas.abap +93 -0
  33. package/abap/zcl_abgagt_util.clas.testclasses.abap +84 -0
  34. package/abap/zcl_abgagt_util.clas.xml +16 -0
  35. package/abap/zif_abgagt_agent.intf.abap +134 -0
  36. package/abap/zif_abgagt_agent.intf.xml +15 -0
  37. package/abap/zif_abgagt_cmd_factory.intf.abap +7 -0
  38. package/abap/zif_abgagt_cmd_factory.intf.xml +15 -0
  39. package/abap/zif_abgagt_command.intf.abap +21 -0
  40. package/abap/zif_abgagt_command.intf.xml +15 -0
  41. package/abap/zif_abgagt_util.intf.abap +28 -0
  42. package/abap/zif_abgagt_util.intf.xml +15 -0
  43. package/bin/abapgit-agent +902 -0
  44. package/img/claude.png +0 -0
  45. package/package.json +31 -0
  46. package/scripts/claude-integration.js +351 -0
  47. package/scripts/test-integration.js +139 -0
  48. package/src/abap-client.js +314 -0
  49. package/src/agent.js +119 -0
  50. package/src/config.js +66 -0
  51. package/src/index.js +48 -0
  52. package/src/logger.js +39 -0
  53. package/src/server.js +116 -0
package/INSTALL.md ADDED
@@ -0,0 +1,160 @@
1
+ # Installation & Setup
2
+
3
+ ## Architecture
4
+
5
+ ```
6
+ Claude (VS Code) → CLI Tool → ABAP System (REST/HTTP)
7
+
8
+ Result + Error Feedback
9
+ ```
10
+
11
+ ## Components
12
+
13
+ ### ABAP Side - REST Implementation
14
+
15
+ | File | Type | Description |
16
+ |------|------|-------------|
17
+ | `zif_abgagt_agent.intf.abap` | Interface | Type definitions and method signatures |
18
+ | `zcl_abgagt_agent.clas.abap` | Class | Main agent with `pull`, `inspect`, `run_tests` methods |
19
+ | `zcl_abgagt_rest_handler.clas.abap` | Class | REST router for endpoints |
20
+ | `zcl_abgagt_resource_pull.clas.abap` | Class | POST /pull handler |
21
+ | `zcl_abgagt_resource_inspect.clas.abap` | Class | POST /inspect handler |
22
+ | `zcl_abgagt_resource_unit.clas.abap` | Class | POST /unit handler |
23
+ | `zcl_abgagt_resource_health.clas.abap` | Class | GET /health handler |
24
+
25
+ **Note:** Error details are returned directly in the REST response via `error_detail` field.
26
+
27
+ ### CLI Tool (Node.js)
28
+ - REST client for ABAP communication
29
+ - Configuration management (reads from cwd/.abapGitAgent)
30
+ - Auto-detects git remote URL and branch from current directory
31
+ - Cookie-based session management
32
+
33
+ ## Why REST API?
34
+
35
+ The REST API approach provides several advantages:
36
+ - **No OData/Gateway needed** - Simpler setup
37
+ - **Standard HTTP** - Easy to debug and test
38
+ - **No SEGW required** - Direct ICF handler
39
+ - **No native dependencies** - Works on any OS
40
+
41
+ ## ABAP System Setup
42
+
43
+ ### Prerequisites
44
+
45
+ The developer version of abapGit is required to deploy the REST handler. Follow the [abapGit developer version installation guide](https://docs.abapgit.org/user-guide/getting-started/install.html#install-developer-version).
46
+
47
+ ### Deploy ABAP Objects
48
+
49
+ Deploy ABAP objects using abapGit:
50
+
51
+ 1. Use abapGit to deploy the ABAP objects in `/abap` folder
52
+ 2. Create SICF handler:
53
+ - Run transaction `SICF`
54
+ - Navigate to: `sap/bc/z_abapgit_agent`
55
+ - Create if doesn't exist:
56
+ - Right-click on `sap/bc` → **Create Element**
57
+ - **Service Name**: `Z_ABAPGIT_AGENT`
58
+ - **Handler Class**: `ZCL_ABGAGT_REST_HANDLER`
59
+ - Activate the service
60
+
61
+ ## CLI Installation
62
+
63
+ ```bash
64
+ # Option A: Install globally for system-level integration
65
+ sudo npm link
66
+
67
+ # Option B: Use from cloned repo
68
+ cd abapgit-agent
69
+ npm install
70
+ ```
71
+
72
+ ## Configuration
73
+
74
+ Copy `.abapGitAgent.example` to `.abapGitAgent` in your repository root:
75
+
76
+ ```bash
77
+ cp .abapGitAgent.example .abapGitAgent
78
+ ```
79
+
80
+ ### Configuration Options
81
+
82
+ **File-based** (.abapGitAgent):
83
+ ```json
84
+ {
85
+ "host": "your-sap-system.com",
86
+ "sapport": 443,
87
+ "client": "100",
88
+ "user": "TECH_USER",
89
+ "password": "your-password",
90
+ "language": "EN",
91
+ "gitUsername": "github-username",
92
+ "gitPassword": "github-token"
93
+ }
94
+ ```
95
+
96
+ **Environment variables**:
97
+ - `ABAP_HOST`, `ABAP_PORT`, `ABAP_CLIENT`, `ABAP_USER`, `ABAP_PASSWORD`
98
+
99
+ ## System-Level Integration
100
+
101
+ This package supports **system-level integration**, meaning any ABAP git repository can use it without cloning this repository:
102
+
103
+ 1. **Install globally**: `sudo npm link`
104
+ 2. **Configure**: Add `.abapGitAgent` to your ABAP repo
105
+ 3. **Use**: Run `abapgit-agent` from your repo directory
106
+
107
+ ## Creating New ABAP Projects
108
+
109
+ ### 1. Create Project Structure
110
+
111
+ ```bash
112
+ # Create new ABAP repository
113
+ mkdir my-abap-repo
114
+ cd my-abap-repo
115
+
116
+ # Copy CLAUDE.md (tells Claude how to work with ABAP)
117
+ cp /path/to/abapgit-agent/abap/CLAUDE.md .
118
+
119
+ # Initialize git
120
+ git init
121
+ ```
122
+
123
+ ### 2. Add ABAP Objects
124
+
125
+ Copy your ABAP objects to the repo:
126
+
127
+ ```bash
128
+ # Copy individual objects
129
+ cp /path/to/abapgit-agent/abap/zcl_*.abap ./
130
+ ```
131
+
132
+ ### 3. Configure and Push
133
+
134
+ ```bash
135
+ # Create .abapGitAgent config
136
+ cp .abapGitAgent.example .abapGitAgent
137
+ # Edit .abapGitAgent with your SAP system details
138
+
139
+ # Initial commit
140
+ git add .
141
+ git commit -m "Initial ABAP project"
142
+
143
+ # Add remote and push
144
+ git remote add origin https://github.com/user/my-abap-repo.git
145
+ git push -u origin main
146
+ ```
147
+
148
+ ### 4. Deploy to SAP
149
+
150
+ Use abapGit in your SAP system to pull the repository.
151
+
152
+ ## Claude Code Integration
153
+
154
+ Claude Code automatically reads `CLAUDE.md` in your project root for context:
155
+
156
+ 1. **No local syntax validation** - Claude knows ABAP needs SAP system
157
+ 2. **Use `abapgit-agent pull`** - For validation after code generation
158
+ 3. **Reference local docs** - See CLAUDE_MEM.md for knowledge management
159
+
160
+ See `abap/CLAUDE.md` for detailed ABAP project guidelines.
package/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # abapGit Agent
2
+
3
+ A local agent that enables AI coding tools (Claude, Copilot, etc.) to automatically pull and activate ABAP code from git repositories using REST API.
4
+
5
+ ## Overview
6
+
7
+ This project provides a bridge between AI coding tools and your ABAP system:
8
+
9
+ 1. **Claude generates ABAP code** → Push to git
10
+ 2. **Local agent pulls from git** → Activates in ABAP system
11
+ 3. **Returns activation results** → Claude fixes errors if any
12
+
13
+ ![Claude using abapgit-agent](img/claude.png)
14
+
15
+ ## Quick Start
16
+
17
+ 1. **Install CLI**: From this repo, run `sudo npm link`
18
+ 2. **Configure repo**: Add `.abapGitAgent` with SAP credentials
19
+ 3. **Validate code**: Run `abapgit-agent pull` after pushing
20
+
21
+ See [Creating New ABAP Projects](INSTALL.md#creating-new-abap-projects) to set up a new ABAP repository with Claude Code integration.
22
+
23
+ ## CLI Commands
24
+
25
+ ```bash
26
+ # Pull and activate (auto-detects git remote and branch)
27
+ abapgit-agent pull
28
+
29
+ # Pull with specific branch
30
+ abapgit-agent pull --branch develop
31
+
32
+ # Pull specific files only (fast iteration)
33
+ abapgit-agent pull --files zcl_my_class.clas.abap,zif_my_intf.intf.abap
34
+
35
+ # Override git URL if needed
36
+ abapgit-agent pull --url https://github.com/user/repo --branch main
37
+
38
+ # Pull with a specific transport request
39
+ abapgit-agent pull --transport DEVK900001
40
+
41
+ # Combine options: files + transport request
42
+ abapgit-agent pull --files zcl_my_class.clas.abap --transport DEVK900001
43
+
44
+ # Inspect source file for issues
45
+ abapgit-agent inspect --files abap/zcl_my_class.clas.abap
46
+
47
+ # Run AUnit tests for test classes
48
+ abapgit-agent unit --files abap/zcl_my_test.clas.testclasses.abap
49
+
50
+ # Run tests for multiple test classes
51
+ abapgit-agent unit --files abap/zcl_test1.clas.testclasses.abap,abap/zcl_test2.clas.testclasses.abap
52
+
53
+ # Health check
54
+ abapgit-agent health
55
+
56
+ # Check integration status
57
+ abapgit-agent status
58
+ ```
59
+
60
+ ## Local Development
61
+
62
+ ```bash
63
+ # Install dependencies
64
+ cd abapgit-agent
65
+ npm install
66
+
67
+ # Run from package directory (auto-detects from git)
68
+ node bin/abapgit-agent pull
69
+
70
+ # Or use npm script
71
+ npm run pull -- --url <git-url> --branch main
72
+ ```
73
+
74
+ ## Unit Tests
75
+
76
+ Run AUnit tests for ABAP test classes and view detailed results:
77
+
78
+ ```bash
79
+ # Run unit tests for a test class file
80
+ abapgit-agent unit --files abap/zcl_my_test.clas.testclasses.abap
81
+
82
+ # Run tests for multiple test classes
83
+ abapgit-agent unit --files abap/zcl_test1.clas.testclasses.abap,abap/zcl_test2.clas.testclasses.abap
84
+ ```
85
+
86
+ ### Output
87
+
88
+ Success case:
89
+ ```
90
+ ✅ ZCL_MY_TEST - All tests passed
91
+ Tests: 10 | Passed: 10 | Failed: 0
92
+ ```
93
+
94
+ Failure case with details:
95
+ ```
96
+ ❌ ZCL_MY_TEST - Tests failed
97
+ Tests: 10 | Passed: 8 | Failed: 2
98
+ ✗ ZCL_MY_TEST=>TEST_METHOD_1: Error description
99
+ ✗ ZCL_MY_TEST=>TEST_METHOD_2: Another error
100
+ ```
101
+
102
+ ### Supported File Formats
103
+
104
+ | File Pattern | Description |
105
+ |--------------|-------------|
106
+ | `zcl_my_test.clas.testclasses.abap` | Test class file |
107
+ | `src/tests/zcl_my_test.clas.testclasses.abap` | With subdirectory path |
108
+
109
+ ## Documentation
110
+
111
+ | Topic | File |
112
+ |-------|------|
113
+ | Installation & Setup | [INSTALL.md](INSTALL.md) |
114
+ | REST API Reference | [API.md](API.md) |
115
+ | Error Handling | [ERROR_HANDLING.md](ERROR_HANDLING.md) |
116
+ | ABAP Coding Guidelines | [abap/CLAUDE.md](abap/CLAUDE.md) |
117
+ | claude-mem Knowledge Management | [CLAUDE_MEM.md](CLAUDE_MEM.md) |
118
+
119
+ ## Dependent Projects
120
+
121
+ This tool depends on and is designed to work with:
122
+
123
+ - [abapGit](https://github.com/abapGit/abapGit) - The foundation for managing ABAP code in git
124
+
125
+ ## License
126
+
127
+ MIT License