abapgit-agent 1.0.0 → 1.1.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.
@@ -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,195 @@
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": "<your-github-username>",
34
+ "gitPassword": "ghp_your_github_token"
35
+ }
36
+ ```
37
+
38
+ ### Environment Variables
39
+
40
+ ```bash
41
+ export GIT_USERNAME="<your-github-username>"
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
+
50
+ 2. Select scopes:
51
+ - `repo` - Full control of private repositories
52
+ - Or `public_repo` if your repo is public
53
+
54
+ ## How It Works
55
+
56
+ 1. **Validate** - Check repository URL exists
57
+ 2. **Find Repo** - Locate abapGit repository by git URL
58
+ 3. **Configure Credentials** - Set git credentials from config
59
+ 4. **Refresh** - Get latest local files from package
60
+ 5. **Stage** - Create stage with all files
61
+ 6. **Commit** - Commit with message
62
+ 7. **Push** - Push to remote
63
+
64
+ ## Workflow
65
+
66
+ ### Full Development Cycle
67
+
68
+ ```
69
+ 1. Develop in ABAP (SAP GUI, ADT)
70
+ └─> Create/modify objects in package
71
+
72
+ 2. abapgit-agent import
73
+ └─> Stages, commits, and pushes to git
74
+
75
+ 3. git pull (optional, in local repo)
76
+ └─> Get files to local folder
77
+
78
+ 4. Repeat
79
+ ```
80
+
81
+ ## Output
82
+
83
+ ### Success
84
+
85
+ ```
86
+ ✅ Objects imported successfully!
87
+ Files staged: 27
88
+ Commit: feat: initial import from ABAP package AUD_TAG
89
+ ```
90
+
91
+ ### With Custom Message
92
+
93
+ ```
94
+ ✅ Objects imported successfully!
95
+ Files staged: 15
96
+ Commit: My custom import message
97
+ ```
98
+
99
+ ### Error - Repository Not Found
100
+
101
+ ```
102
+ ❌ Import failed
103
+ Error: Repository not found. Run "abapgit-agent create" or create in abapGit UI first.
104
+ ```
105
+
106
+ ### Error - No Objects Found
107
+
108
+ ```
109
+ ❌ Import failed
110
+ Error: No objects found in package ZMY_PACKAGE
111
+ ```
112
+
113
+ ### Error - GitHub Credentials
114
+
115
+ ```
116
+ ❌ Import failed
117
+ Error: Unauthorized access to resource (HTTP 401)
118
+ ```
119
+
120
+ ## Troubleshooting
121
+
122
+ ### HTTP 401 Unauthorized
123
+
124
+ GitHub credentials not configured or invalid:
125
+
126
+ 1. Create a GitHub Personal Access Token
127
+ 2. Add to `.abapGitAgent`:
128
+
129
+ ```json
130
+ {
131
+ "gitUsername": "<your-github-username>",
132
+ "gitPassword": "ghp_your_token"
133
+ }
134
+ ```
135
+
136
+ ### Repository Not Found
137
+
138
+ The repository must exist in abapGit:
139
+
140
+ 1. Run `abapgit-agent create` to create it, OR
141
+ 2. Create manually in abapGit UI: https://<sap>/sap/bc/zabapgit
142
+
143
+ ### No Objects Found
144
+
145
+ The package may be empty or objects not yet created:
146
+
147
+ 1. Verify package in SAP GUI: `SE21` → Display Package
148
+ 2. Ensure objects exist in the package
149
+
150
+ ## Full Workflow
151
+
152
+ ### Option 1: abapgit-agent (Recommended)
153
+
154
+ ```bash
155
+ # Initialize
156
+ abapgit-agent init --folder /abap --package ZMYPROJECT
157
+
158
+ # Edit config
159
+ vim .abapGitAgent
160
+
161
+ # Create repository
162
+ abapgit-agent create
163
+
164
+ # Develop objects in ABAP...
165
+
166
+ # Import objects to git
167
+ abapgit-agent import
168
+
169
+ # Pull to local folder
170
+ git pull origin main
171
+ ```
172
+
173
+ ### Option 2: abapGit UI for Creation
174
+
175
+ ```bash
176
+ # Initialize
177
+ abapgit-agent init --folder /abap --package ZMYPROJECT
178
+
179
+ # Edit config
180
+ vim .abapGitAgent
181
+
182
+ # Create repository in abapGit UI
183
+ # https://<sap>/sap/bc/zabapgit → New → Online → Enter git URL
184
+
185
+ # Develop objects in ABAP...
186
+
187
+ # Import objects to git
188
+ abapgit-agent import
189
+ ```
190
+
191
+ ## Related Commands
192
+
193
+ - [`init`](init-command.md) - Initialize local configuration
194
+ - [`create`](create-command.md) - Create online repository in ABAP
195
+ - [`pull`](pull-command.md) - Pull and activate objects in ABAP
@@ -0,0 +1,189 @@
1
+ # init Command
2
+
3
+ Initialize local configuration for an existing git repository.
4
+
5
+ ## Command
6
+
7
+ ```bash
8
+ abapgit-agent init --folder /src/ --package ZMY_PACKAGE
9
+ ```
10
+
11
+ ## Prerequisite
12
+
13
+ - Current folder is the root folder of a git repository
14
+ - Git remote is configured (`git remote -v` returns a URL)
15
+
16
+ ## Parameters
17
+
18
+ | Parameter | Required | Default | Description |
19
+ |-----------|----------|---------|-------------|
20
+ | `--folder` | No | `/src/` | Subfolder path for ABAP source files |
21
+ | `--package` | Yes | - | Target ABAP package |
22
+
23
+ ## Tasks
24
+
25
+ ### 1. Detect Git Remote URL
26
+
27
+ ```bash
28
+ git remote get-url origin
29
+ ```
30
+
31
+ - Fail if no remote configured
32
+
33
+ ### 2. Copy Configuration Template
34
+
35
+ ```bash
36
+ cp .abapGitAgent.example .abapGitAgent
37
+ ```
38
+
39
+ ### 3. Update Configuration
40
+
41
+ Add to `.abapGitAgent`:
42
+
43
+ ```json
44
+ {
45
+ "package": "ZMY_PACKAGE",
46
+ "folder": "/src/"
47
+ }
48
+ ```
49
+
50
+ ### 4. Create Folder
51
+
52
+ ```bash
53
+ mkdir -p /src/
54
+ ```
55
+
56
+ Add `.gitkeep` (optional):
57
+
58
+ ```bash
59
+ touch /src/.gitkeep
60
+ ```
61
+
62
+ ### 5. Update .gitignore
63
+
64
+ Add sensitive files to `.gitignore`:
65
+
66
+ ```
67
+ .abapGitAgent
68
+ .abapgit_agent_cookies.txt
69
+ ```
70
+
71
+ ### 6. Copy Documentation
72
+
73
+ ```bash
74
+ cp /path/to/abapgit-agent/abap/CLAUDE.md .
75
+ ```
76
+
77
+ ## Output Files
78
+
79
+ | File | Description |
80
+ |------|-------------|
81
+ | `.abapGitAgent` | Configuration (user must edit host, user, password, gitUsername, gitPassword) |
82
+ | `.gitignore` | Updated with sensitive files |
83
+ | `CLAUDE.md` | ABAP coding guidelines |
84
+ | `/src/` | Folder for ABAP source files |
85
+
86
+ ## .abapGitAgent Contents
87
+
88
+ After `init` command, `.abapGitAgent` contains:
89
+
90
+ ```json
91
+ {
92
+ "host": "your-sap-system.com",
93
+ "sapport": 443,
94
+ "client": "100",
95
+ "user": "TECH_USER",
96
+ "password": "your-password",
97
+ "language": "EN",
98
+ "gitUsername": "github-username",
99
+ "gitPassword": "github-token",
100
+ "referenceFolder": "~/abap-reference",
101
+ "package": "ZMY_PACKAGE",
102
+ "folder": "/src/"
103
+ }
104
+ ```
105
+
106
+ ## GitHub Credentials
107
+
108
+ For the `import` command to work, you need to configure GitHub credentials:
109
+
110
+ 1. Create a GitHub Personal Access Token (PAT):
111
+ - GitHub.com: https://github.com/settings/tokens
112
+
113
+ 2. Add to `.abapGitAgent`:
114
+
115
+ ```json
116
+ {
117
+ "gitUsername": "<your-github-username>",
118
+ "gitPassword": "ghp_your_token_here"
119
+ }
120
+ ```
121
+
122
+ Or set environment variables:
123
+
124
+ ```bash
125
+ export GIT_USERNAME="<your-github-username>"
126
+ export GIT_PASSWORD="ghp_your_token_here"
127
+ ```
128
+
129
+ ## Post-Init Steps
130
+
131
+ 1. Edit `.abapGitAgent` with correct values:
132
+ - `host`: SAP system hostname
133
+ - `user`: SAP username
134
+ - `password`: SAP password
135
+ - `gitUsername`: GitHub username (for import command)
136
+ - `gitPassword`: GitHub PAT (for import command)
137
+
138
+ 2. Run `abapgit-agent create` to create abapGit repo in ABAP
139
+
140
+ 3. Run `abapgit-agent import` to import objects to git
141
+
142
+ ## Full Workflow
143
+
144
+ ```
145
+ 1. abapgit-agent init --folder /src/ --package ZMY_PACKAGE
146
+ └─> Creates .abapGitAgent, CLAUDE.md, /src/, updates .gitignore
147
+
148
+ 2. Edit .abapGitAgent (host, user, password, gitUsername, gitPassword)
149
+
150
+ 3. abapgit-agent create
151
+ └─> Creates online repository in ABAP
152
+
153
+ 4. abapgit-agent import
154
+ └─> Stages, commits, and pushes all objects from ZMY_PACKAGE
155
+
156
+ 5. git pull
157
+ └─> Optionally pull to local folder
158
+
159
+ 6. abapgit-agent pull
160
+ └─> Activate objects in ABAP
161
+ ```
162
+
163
+ ## Example
164
+
165
+ ```bash
166
+ # Initialize
167
+ abapgit-agent init --folder /abap/ --package ZMYPROJECT
168
+
169
+ # Edit config
170
+ vim .abapGitAgent
171
+
172
+ # Create repo
173
+ abapgit-agent create
174
+
175
+ # Import objects to git
176
+ abapgit-agent import
177
+
178
+ # Pull to local folder
179
+ git pull origin main
180
+
181
+ # Activate in ABAP
182
+ abapgit-agent pull
183
+ ```
184
+
185
+ ## Related Commands
186
+
187
+ - [`create`](create-command.md) - Create online repository in ABAP
188
+ - [`import`](import-command.md) - Import objects from package to git
189
+ - [`pull`](pull-command.md) - Pull and activate objects in ABAP
@@ -0,0 +1,158 @@
1
+ # inspect Command Requirements
2
+
3
+ ## Overview
4
+
5
+ Inspect ABAP source file(s) for syntax errors and issues.
6
+
7
+ ## Command
8
+
9
+ ```bash
10
+ # Inspect single file
11
+ abapgit-agent inspect --files zcl_my_class.clas.abap
12
+
13
+ # Inspect multiple files
14
+ abapgit-agent inspect --files zcl_my_class.clas.abap,zcl_other.clas.abap
15
+
16
+ # With path
17
+ abapgit-agent inspect --files abap/zcl_my_class.clas.abap
18
+ ```
19
+
20
+ ## Prerequisite
21
+
22
+ - `.abapGitAgent` exists with valid credentials
23
+ - Files must exist in the filesystem
24
+
25
+ ## Parameters
26
+
27
+ | Parameter | Required | Description |
28
+ |-----------|----------|-------------|
29
+ | `--files` | Yes | Comma-separated list of files to inspect |
30
+
31
+ ---
32
+
33
+ ## Tasks
34
+
35
+ ### 1. Validate Parameters
36
+
37
+ - `--files` must be specified
38
+ - Files must exist
39
+
40
+ ### 2. Load Configuration
41
+
42
+ Read `.abapGitAgent` for credentials
43
+
44
+ ### 3. Fetch CSRF Token
45
+
46
+ ```bash
47
+ GET /health (with X-CSRF-Token: fetch)
48
+ ```
49
+
50
+ ### 4. Make Inspect Request
51
+
52
+ **Endpoint:** `POST /inspect`
53
+
54
+ **Request Body:**
55
+ ```json
56
+ {
57
+ "files": ["ZCL_MY_CLASS.CLASS.ABAP"]
58
+ }
59
+ ```
60
+
61
+ ### 5. Display Results
62
+
63
+ ---
64
+
65
+ ## Output
66
+
67
+ ### Success (No Errors)
68
+
69
+ ```
70
+ Inspect for 1 file(s)
71
+
72
+ ✅ zcl_my_class.clas.abap - Syntax check passed (0 errors)
73
+ ```
74
+
75
+ ### With Errors
76
+
77
+ ```
78
+ Inspect for 1 file(s)
79
+
80
+ ❌ Syntax check failed (2 error(s)):
81
+
82
+ Errors:
83
+ ────────────────────────────────────────────────────────────
84
+ Line 15, Column 10:
85
+ "ZMYCLASS" is not a type
86
+
87
+ Line 20, Column 5:
88
+ Field "LV_VAR" is unknown
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Response Structure
94
+
95
+ ```json
96
+ {
97
+ "success": "X",
98
+ "object_type": "CLAS",
99
+ "object_name": "ZCL_MY_CLASS",
100
+ "error_count": 2,
101
+ "errors": [
102
+ {
103
+ "line": "15",
104
+ "column": "10",
105
+ "text": "\"ZMYCLASS\" is not a type",
106
+ "word": "ZMYCLASS"
107
+ }
108
+ ]
109
+ }
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Error Handling
115
+
116
+ | Error | Message |
117
+ |-------|---------|
118
+ | File not found | `File not found: <path>` |
119
+ | Invalid file format | `Invalid file format: <file>` |
120
+ | No --files specified | `Error: --files parameter required` |
121
+
122
+ ---
123
+
124
+ ## File Format
125
+
126
+ Same as pull command - files are parsed to extract object type and name:
127
+
128
+ | File | Object Type | Object Name |
129
+ |------|-------------|-------------|
130
+ | `zcl_my_class.clas.abap` | CLAS | ZCL_MY_CLASS |
131
+ | `zif_my_intf.intf.abap` | INTF | ZIF_MY_INTF |
132
+
133
+ ---
134
+
135
+ ## Example
136
+
137
+ ```bash
138
+ # Syntax check
139
+ abapgit-agent inspect --files zcl_my_class.clas.abap
140
+
141
+ # Multiple files
142
+ abapgit-agent inspect --files abap/zcl_my_class.clas.abap,abap/zcl_other.clas.abap
143
+ ```
144
+
145
+ ## Use Case
146
+
147
+ Use `inspect` when:
148
+ - Pull shows "Error updating where-used list" (syntax error)
149
+ - You need detailed error messages with line numbers
150
+ - Debugging activation failures
151
+
152
+ ```
153
+ abapgit-agent pull
154
+ ❌ CLAS ZCL_MY_CLASS: Error updating where-used list
155
+
156
+ abapgit-agent inspect --files abap/zcl_my_class.clas.abap
157
+ ❌ Line 15, Column 10: "ZMYCLASS" is not a type
158
+ ```