abapgit-agent 1.0.0 → 1.0.1

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.
@@ -0,0 +1,107 @@
1
+ # Commands Overview
2
+
3
+ All available CLI commands for abapGit Agent.
4
+
5
+ ## Command Reference
6
+
7
+ | Command | Status | Description | File |
8
+ |---------|--------|-------------|------|
9
+ | [init](init-command.md) | ✅ | Initialize local configuration | Initialize local configuration for git repo |
10
+ | [create](create-command.md) | TODO | Create online repository | Create abapGit repo in ABAP system |
11
+ | [pull](pull-command.md) | ✅ | Pull and activate | Pull objects from git and activate in ABAP |
12
+ | [inspect](inspect-command.md) | ✅ | Syntax check | Check ABAP source files for errors |
13
+ | [unit](unit-command.md) | ✅ | Run unit tests | Execute AUnit tests |
14
+ | [health](health-command.md) | ✅ | Health check | Verify ABAP REST API is accessible |
15
+ | [status](status-command.md) | ✅ | Status check | Check if configured for current repo |
16
+
17
+ ---
18
+
19
+ ## Implemented Commands
20
+
21
+ ### Daily Development
22
+
23
+ ```bash
24
+ # Pull changes (auto-detects git remote)
25
+ abapgit-agent pull
26
+
27
+ # Syntax check before commit
28
+ abapgit-agent inspect --files abap/zcl_my_class.clas.abap
29
+
30
+ # Run tests
31
+ abapgit-agent unit --files abap/zcl_my_test.clas.testclasses.abap
32
+
33
+ # Check configuration
34
+ abapgit-agent status
35
+
36
+ # Verify ABAP connection
37
+ abapgit-agent health
38
+ ```
39
+
40
+ ---
41
+
42
+ ## TODO Commands (Not Yet Implemented)
43
+
44
+ ### New Project Setup
45
+
46
+ ```bash
47
+ # 1. Initialize local configuration
48
+ abapgit-agent init --folder /src --package ZMY_PACKAGE
49
+
50
+ # 2. Edit .abapGitAgent with credentials
51
+ vim .abapGitAgent
52
+
53
+ # 3. Create online repo and import existing objects
54
+ abapgit-agent create --import
55
+
56
+ # 4. Push to git
57
+ git push
58
+
59
+ # 5. Activate in ABAP
60
+ abapgit-agent pull
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Planned Command Flow
66
+
67
+ ```
68
+ ┌─────────────────────────────────────────────────┐
69
+ │ init │ ← TODO
70
+ │ └── Creates .abapGitAgent, CLAUDE.md, /src/ │
71
+ └─────────────────────────────────────────────────┘
72
+
73
+
74
+ ┌─────────────────────────────────────────────────┐
75
+ │ create --import │ ← TODO
76
+ │ └── Creates repo in ABAP, imports objects │
77
+ └─────────────────────────────────────────────────┘
78
+
79
+
80
+ ┌─────────────────────────────────────────────────┐
81
+ │ git push │
82
+ └─────────────────────────────────────────────────┘
83
+
84
+
85
+ ┌─────────────────────────────────────────────────┐
86
+ │ pull │
87
+ │ └── Activates objects in ABAP │
88
+ └─────────────────────────────────────────────────┘
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Common Options
94
+
95
+ ### Global Parameters
96
+
97
+ All commands read configuration from:
98
+ - `.abapGitAgent` file in current directory
99
+ - Environment variables (`ABAP_HOST`, `ABAP_USER`, etc.)
100
+
101
+ ### File Patterns
102
+
103
+ | Pattern | Description |
104
+ |---------|-------------|
105
+ | `zcl_my_class.clas.abap` | ABAP class source |
106
+ | `zif_my_intf.intf.abap` | ABAP interface source |
107
+ | `zcl_my_test.clas.testclasses.abap` | ABAP test class |
@@ -0,0 +1,211 @@
1
+ # create Command Requirements
2
+
3
+ ## Overview
4
+
5
+ > **TODO**: This command is not yet implemented.
6
+
7
+ Create a new abapGit online repository in the ABAP system.
8
+
9
+ ## Command
10
+
11
+ ```bash
12
+ # Create online repo only
13
+ abapgit-agent create
14
+
15
+ # Create online repo and import existing objects
16
+ abapgit-agent create --import
17
+ ```
18
+
19
+ ## Prerequisite
20
+
21
+ - `init` command has been run successfully
22
+ - `.abapGitAgent` file exists
23
+ - User has edited `.abapGitAgent` with correct credentials (host, user, password)
24
+ - Current folder is git repo root
25
+
26
+ ## Parameters
27
+
28
+ | Parameter | Required | Description |
29
+ |-----------|----------|-------------|
30
+ | `--import` | No | Import existing objects from package to git repo |
31
+
32
+ ---
33
+
34
+ ## Tasks
35
+
36
+ ### 1. Validate Configuration
37
+
38
+ ```bash
39
+ abapgit-agent status
40
+ ```
41
+
42
+ - Verify `.abapGitAgent` exists
43
+ - Verify git repo is configured
44
+
45
+ ```bash
46
+ abapgit-agent health
47
+ ```
48
+
49
+ - Verify ABAP connection is healthy
50
+
51
+ ### 2. Read Configuration
52
+
53
+ Read `.abapGitAgent` and extract:
54
+ - `host`, `sapport`, `client`, `user`, `password`, `language`
55
+ - `package`
56
+ - `folder`
57
+
58
+ ### 3. Get Git Remote URL
59
+
60
+ ```bash
61
+ git remote get-url origin
62
+ ```
63
+
64
+ ### 4. Create abapGit Online Repository
65
+
66
+ **Endpoint:** `POST /create`
67
+
68
+ **Request Body:**
69
+ ```json
70
+ {
71
+ "url": "https://github.com/org/repo.git",
72
+ "package": "ZMY_PACKAGE",
73
+ "folder_logic": "FULL",
74
+ "folder": "/src"
75
+ }
76
+ ```
77
+
78
+ ### 5. If `--import`: Pull Existing Objects
79
+
80
+ - Use `folder` from `.abapGitAgent`
81
+ - Pull existing objects from package (no objects if package is empty)
82
+ - Write files to folder
83
+ - Git commit
84
+
85
+ ---
86
+
87
+ ## Output
88
+
89
+ ### Success (without --import)
90
+
91
+ ```
92
+ ✅ Online repository created successfully
93
+ URL: https://github.com/org/repo.git
94
+ Package: ZMY_PACKAGE
95
+ Name: repo
96
+
97
+ Next steps:
98
+ abapgit-agent pull
99
+ ```
100
+
101
+ ### Success (with --import)
102
+
103
+ ```
104
+ ✅ Online repository created successfully
105
+ URL: https://github.com/org/repo.git
106
+ Package: ZMY_PACKAGE
107
+ Name: repo
108
+
109
+ ✅ Objects imported from package
110
+ Files: 15
111
+ Commit: feat: initial import from ABAP package ZMY_PACKAGE
112
+
113
+ Next steps:
114
+ git push
115
+ abapgit-agent pull
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Error Handling
121
+
122
+ | Error | Message |
123
+ |-------|---------|
124
+ | No .abapGitAgent | Run `init` command first |
125
+ | Missing credentials | Edit .abapGitAgent (host, user, password) |
126
+ | Health check failed | Check ABAP system connection |
127
+ | Repo already exists | Repository already exists in ABAP |
128
+ | Package not found | Package ZMY_PACKAGE does not exist |
129
+ | API error | Failed to create repository |
130
+
131
+ ---
132
+
133
+ ## Full Workflow
134
+
135
+ ```
136
+ 1. abapgit-agent init --folder /src --package ZMY_PACKAGE
137
+ └─> Creates .abapGitAgent, CLAUDE.md, /src/
138
+
139
+ 2. Edit .abapGitAgent (host, user, password)
140
+
141
+ 3. abapgit-agent online --import
142
+ └─> Creates repo in ABAP, imports objects, commits
143
+
144
+ 4. git push origin main
145
+
146
+ 5. abapgit-agent pull
147
+ └─> Activates objects in ABAP
148
+ ```
149
+
150
+ ## Example
151
+
152
+ ```bash
153
+ # Initialize
154
+ abapgit-agent init --folder /abap --package ZMYPROJECT
155
+
156
+ # Edit config
157
+ vim .abapGitAgent
158
+
159
+ # Create online repo with import
160
+ abapgit-agent online --import
161
+
162
+ # Push to git
163
+ git push origin main
164
+
165
+ # Activate in ABAP
166
+ abapgit-agent pull
167
+ ```
168
+
169
+ ## API Reference
170
+
171
+ ### Create Online Repository
172
+
173
+ **Endpoint:** `POST /create`
174
+
175
+ **Request:**
176
+ ```
177
+ POST /online
178
+ Content-Type: application/json
179
+
180
+ {
181
+ "url": "https://github.com/org/repo.git",
182
+ "package": "ZMY_PACKAGE",
183
+ "folder_logic": "FULL",
184
+ "folder": "/src"
185
+ }
186
+ ```
187
+
188
+ **Response:**
189
+ ```
190
+ HTTP/2 201 Created
191
+ Content-Type: application/json
192
+
193
+ {
194
+ "key": "REPO_KEY_123",
195
+ "url": "https://github.com/org/repo.git",
196
+ "package": "ZMY_PACKAGE",
197
+ "name": "repo"
198
+ }
199
+ ```
200
+
201
+ ### Error Response
202
+
203
+ ```
204
+ HTTP/4xx
205
+ Content-Type: application/json
206
+
207
+ {
208
+ "error": "Repository already exists",
209
+ "message": "Repository with URL https://github.com/org/repo.git already exists"
210
+ }
211
+ ```
@@ -0,0 +1,89 @@
1
+ # health Command Requirements
2
+
3
+ ## Overview
4
+
5
+ Check if the ABAP REST API is healthy and accessible.
6
+
7
+ ## Command
8
+
9
+ ```bash
10
+ abapgit-agent health
11
+ ```
12
+
13
+ ## Prerequisite
14
+
15
+ - `.abapGitAgent` file exists with valid credentials, or environment variables are set
16
+
17
+ ## Tasks
18
+
19
+ ### 1. Load Configuration
20
+
21
+ Read from `.abapGitAgent` or environment variables:
22
+ - `host`
23
+ - `sapport`
24
+ - `client`
25
+ - `user`
26
+ - `password`
27
+ - `language`
28
+
29
+ ### 2. Make Health Check Request
30
+
31
+ **Endpoint:** `GET /health`
32
+
33
+ **Response:**
34
+ ```json
35
+ {
36
+ "status": "healthy",
37
+ "abap": "connected",
38
+ "version": "1.0.0"
39
+ }
40
+ ```
41
+
42
+ ### 3. Display Result
43
+
44
+ ```bash
45
+ $ abapgit-agent health
46
+ {
47
+ "status": "healthy",
48
+ "abap": "connected",
49
+ "version": "1.0.0"
50
+ }
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Output
56
+
57
+ | Status | Output |
58
+ |--------|--------|
59
+ | Healthy | JSON response with status |
60
+ | Error | Error message with details |
61
+
62
+ ---
63
+
64
+ ## Error Handling
65
+
66
+ | Error | Message |
67
+ |-------|---------|
68
+ | Connection failed | `Health check failed: <error message>` |
69
+ | Invalid credentials | Authentication error |
70
+
71
+ ---
72
+
73
+ ## Example
74
+
75
+ ```bash
76
+ # Check health
77
+ abapgit-agent health
78
+
79
+ # Output
80
+ {
81
+ "status": "healthy",
82
+ "abap": "connected",
83
+ "version": "1.0.0"
84
+ }
85
+ ```
86
+
87
+ ## Used By
88
+
89
+ - `create` command - validates ABAP connection before creating repo
@@ -0,0 +1,196 @@
1
+ # import Command
2
+
3
+ Import existing ABAP objects from a package into an existing abapGit online repository.
4
+
5
+ ## Command
6
+
7
+ ```bash
8
+ abapgit-agent import
9
+ abapgit-agent import --message "Your commit message"
10
+ ```
11
+
12
+ ## Prerequisites
13
+
14
+ - Repository already exists in ABAP (created via abapGit UI or `create` command)
15
+ - Package has objects to import
16
+ - GitHub credentials configured in `.abapGitAgent`
17
+
18
+ ## Parameters
19
+
20
+ | Parameter | Required | Default | Description |
21
+ |-----------|----------|---------|-------------|
22
+ | `--message` | No | `feat: initial import from ABAP package <package>` | Commit message |
23
+ | `--help` | No | - | Show help |
24
+
25
+ ## Configuration
26
+
27
+ ### .abapGitAgent
28
+
29
+ Add GitHub credentials to `.abapGitAgent`:
30
+
31
+ ```json
32
+ {
33
+ "gitUsername": "I045696",
34
+ "gitPassword": "ghp_your_github_token"
35
+ }
36
+ ```
37
+
38
+ ### Environment Variables
39
+
40
+ ```bash
41
+ export GIT_USERNAME="I045696"
42
+ export GIT_PASSWORD="ghp_your_github_token"
43
+ ```
44
+
45
+ ### GitHub Personal Access Token
46
+
47
+ 1. Create a PAT at:
48
+ - GitHub.com: https://github.com/settings/tokens
49
+ - GitHub Enterprise: https://github.tools.sap/settings/tokens
50
+
51
+ 2. Select scopes:
52
+ - `repo` - Full control of private repositories
53
+ - Or `public_repo` if your repo is public
54
+
55
+ ## How It Works
56
+
57
+ 1. **Validate** - Check repository URL exists
58
+ 2. **Find Repo** - Locate abapGit repository by git URL
59
+ 3. **Configure Credentials** - Set git credentials from config
60
+ 4. **Refresh** - Get latest local files from package
61
+ 5. **Stage** - Create stage with all files
62
+ 6. **Commit** - Commit with message
63
+ 7. **Push** - Push to remote
64
+
65
+ ## Workflow
66
+
67
+ ### Full Development Cycle
68
+
69
+ ```
70
+ 1. Develop in ABAP (SAP GUI, ADT)
71
+ └─> Create/modify objects in package
72
+
73
+ 2. abapgit-agent import
74
+ └─> Stages, commits, and pushes to git
75
+
76
+ 3. git pull (optional, in local repo)
77
+ └─> Get files to local folder
78
+
79
+ 4. Repeat
80
+ ```
81
+
82
+ ## Output
83
+
84
+ ### Success
85
+
86
+ ```
87
+ ✅ Objects imported successfully!
88
+ Files staged: 27
89
+ Commit: feat: initial import from ABAP package AUD_TAG
90
+ ```
91
+
92
+ ### With Custom Message
93
+
94
+ ```
95
+ ✅ Objects imported successfully!
96
+ Files staged: 15
97
+ Commit: My custom import message
98
+ ```
99
+
100
+ ### Error - Repository Not Found
101
+
102
+ ```
103
+ ❌ Import failed
104
+ Error: Repository not found. Run "abapgit-agent create" or create in abapGit UI first.
105
+ ```
106
+
107
+ ### Error - No Objects Found
108
+
109
+ ```
110
+ ❌ Import failed
111
+ Error: No objects found in package ZMY_PACKAGE
112
+ ```
113
+
114
+ ### Error - GitHub Credentials
115
+
116
+ ```
117
+ ❌ Import failed
118
+ Error: Unauthorized access to resource (HTTP 401)
119
+ ```
120
+
121
+ ## Troubleshooting
122
+
123
+ ### HTTP 401 Unauthorized
124
+
125
+ GitHub credentials not configured or invalid:
126
+
127
+ 1. Create a GitHub Personal Access Token
128
+ 2. Add to `.abapGitAgent`:
129
+
130
+ ```json
131
+ {
132
+ "gitUsername": "I045696",
133
+ "gitPassword": "ghp_your_token"
134
+ }
135
+ ```
136
+
137
+ ### Repository Not Found
138
+
139
+ The repository must exist in abapGit:
140
+
141
+ 1. Run `abapgit-agent create` to create it, OR
142
+ 2. Create manually in abapGit UI: https://<sap>/sap/bc/zabapgit
143
+
144
+ ### No Objects Found
145
+
146
+ The package may be empty or objects not yet created:
147
+
148
+ 1. Verify package in SAP GUI: `SE21` → Display Package
149
+ 2. Ensure objects exist in the package
150
+
151
+ ## Full Workflow
152
+
153
+ ### Option 1: abapgit-agent (Recommended)
154
+
155
+ ```bash
156
+ # Initialize
157
+ abapgit-agent init --folder /abap --package ZMYPROJECT
158
+
159
+ # Edit config
160
+ vim .abapGitAgent
161
+
162
+ # Create repository
163
+ abapgit-agent create
164
+
165
+ # Develop objects in ABAP...
166
+
167
+ # Import objects to git
168
+ abapgit-agent import
169
+
170
+ # Pull to local folder
171
+ git pull origin main
172
+ ```
173
+
174
+ ### Option 2: abapGit UI for Creation
175
+
176
+ ```bash
177
+ # Initialize
178
+ abapgit-agent init --folder /abap --package ZMYPROJECT
179
+
180
+ # Edit config
181
+ vim .abapGitAgent
182
+
183
+ # Create repository in abapGit UI
184
+ # https://<sap>/sap/bc/zabapgit → New → Online → Enter git URL
185
+
186
+ # Develop objects in ABAP...
187
+
188
+ # Import objects to git
189
+ abapgit-agent import
190
+ ```
191
+
192
+ ## Related Commands
193
+
194
+ - [`init`](init-command.md) - Initialize local configuration
195
+ - [`create`](create-command.md) - Create online repository in ABAP
196
+ - [`pull`](pull-command.md) - Pull and activate objects in ABAP