abapgit-agent 1.5.0 → 1.6.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 (117) hide show
  1. package/README.md +1 -0
  2. package/abap/guidelines/00_index.md +35 -0
  3. package/abap/guidelines/01_sql.md +72 -0
  4. package/abap/guidelines/02_exceptions.md +108 -0
  5. package/abap/guidelines/03_testing.md +252 -0
  6. package/abap/guidelines/04_cds.md +120 -0
  7. package/abap/guidelines/05_classes.md +50 -0
  8. package/abap/guidelines/06_objects.md +103 -0
  9. package/abap/guidelines/07_json.md +22 -0
  10. package/abap/guidelines/08_abapgit.md +193 -0
  11. package/bin/abapgit-agent +467 -30
  12. package/bin/abgagt +24 -0
  13. package/package.json +8 -2
  14. package/src/abap-client.js +65 -2
  15. package/src/agent.js +57 -3
  16. package/src/ref-search.js +989 -0
  17. package/.abapGitAgent.example +0 -11
  18. package/.github/workflows/release.yml +0 -60
  19. package/API.md +0 -710
  20. package/CLAUDE.md +0 -1058
  21. package/CLAUDE_MEM.md +0 -88
  22. package/ERROR_HANDLING.md +0 -30
  23. package/INSTALL.md +0 -155
  24. package/RELEASE_NOTES.md +0 -143
  25. package/abap/CLAUDE.md +0 -1010
  26. package/abap/copilot-instructions.md +0 -79
  27. package/abap/package.devc.xml +0 -10
  28. package/abap/zcl_abgagt_agent.clas.abap +0 -420
  29. package/abap/zcl_abgagt_agent.clas.xml +0 -15
  30. package/abap/zcl_abgagt_cmd_factory.clas.abap +0 -48
  31. package/abap/zcl_abgagt_cmd_factory.clas.xml +0 -15
  32. package/abap/zcl_abgagt_command_create.clas.abap +0 -95
  33. package/abap/zcl_abgagt_command_create.clas.xml +0 -15
  34. package/abap/zcl_abgagt_command_import.clas.abap +0 -138
  35. package/abap/zcl_abgagt_command_import.clas.xml +0 -15
  36. package/abap/zcl_abgagt_command_inspect.clas.abap +0 -456
  37. package/abap/zcl_abgagt_command_inspect.clas.testclasses.abap +0 -121
  38. package/abap/zcl_abgagt_command_inspect.clas.xml +0 -16
  39. package/abap/zcl_abgagt_command_preview.clas.abap +0 -386
  40. package/abap/zcl_abgagt_command_preview.clas.xml +0 -15
  41. package/abap/zcl_abgagt_command_pull.clas.abap +0 -80
  42. package/abap/zcl_abgagt_command_pull.clas.testclasses.abap +0 -87
  43. package/abap/zcl_abgagt_command_pull.clas.xml +0 -16
  44. package/abap/zcl_abgagt_command_tree.clas.abap +0 -237
  45. package/abap/zcl_abgagt_command_tree.clas.xml +0 -15
  46. package/abap/zcl_abgagt_command_unit.clas.abap +0 -297
  47. package/abap/zcl_abgagt_command_unit.clas.xml +0 -15
  48. package/abap/zcl_abgagt_command_view.clas.abap +0 -240
  49. package/abap/zcl_abgagt_command_view.clas.xml +0 -15
  50. package/abap/zcl_abgagt_resource_create.clas.abap +0 -71
  51. package/abap/zcl_abgagt_resource_create.clas.xml +0 -15
  52. package/abap/zcl_abgagt_resource_health.clas.abap +0 -25
  53. package/abap/zcl_abgagt_resource_health.clas.xml +0 -15
  54. package/abap/zcl_abgagt_resource_import.clas.abap +0 -66
  55. package/abap/zcl_abgagt_resource_import.clas.xml +0 -15
  56. package/abap/zcl_abgagt_resource_inspect.clas.abap +0 -63
  57. package/abap/zcl_abgagt_resource_inspect.clas.xml +0 -15
  58. package/abap/zcl_abgagt_resource_preview.clas.abap +0 -67
  59. package/abap/zcl_abgagt_resource_preview.clas.xml +0 -15
  60. package/abap/zcl_abgagt_resource_pull.clas.abap +0 -71
  61. package/abap/zcl_abgagt_resource_pull.clas.xml +0 -15
  62. package/abap/zcl_abgagt_resource_tree.clas.abap +0 -70
  63. package/abap/zcl_abgagt_resource_tree.clas.xml +0 -15
  64. package/abap/zcl_abgagt_resource_unit.clas.abap +0 -64
  65. package/abap/zcl_abgagt_resource_unit.clas.xml +0 -15
  66. package/abap/zcl_abgagt_resource_view.clas.abap +0 -68
  67. package/abap/zcl_abgagt_resource_view.clas.xml +0 -15
  68. package/abap/zcl_abgagt_rest_handler.clas.abap +0 -32
  69. package/abap/zcl_abgagt_rest_handler.clas.xml +0 -15
  70. package/abap/zcl_abgagt_util.clas.abap +0 -93
  71. package/abap/zcl_abgagt_util.clas.testclasses.abap +0 -84
  72. package/abap/zcl_abgagt_util.clas.xml +0 -16
  73. package/abap/zcl_abgagt_viewer_clas.clas.abap +0 -58
  74. package/abap/zcl_abgagt_viewer_clas.clas.xml +0 -15
  75. package/abap/zcl_abgagt_viewer_ddls.clas.abap +0 -83
  76. package/abap/zcl_abgagt_viewer_ddls.clas.xml +0 -15
  77. package/abap/zcl_abgagt_viewer_dtel.clas.abap +0 -98
  78. package/abap/zcl_abgagt_viewer_dtel.clas.xml +0 -15
  79. package/abap/zcl_abgagt_viewer_factory.clas.abap +0 -41
  80. package/abap/zcl_abgagt_viewer_factory.clas.xml +0 -15
  81. package/abap/zcl_abgagt_viewer_intf.clas.abap +0 -58
  82. package/abap/zcl_abgagt_viewer_intf.clas.xml +0 -15
  83. package/abap/zcl_abgagt_viewer_stru.clas.abap +0 -59
  84. package/abap/zcl_abgagt_viewer_stru.clas.xml +0 -15
  85. package/abap/zcl_abgagt_viewer_tabl.clas.abap +0 -59
  86. package/abap/zcl_abgagt_viewer_tabl.clas.xml +0 -15
  87. package/abap/zcl_abgagt_viewer_ttyp.clas.abap +0 -93
  88. package/abap/zcl_abgagt_viewer_ttyp.clas.xml +0 -15
  89. package/abap/zif_abgagt_agent.intf.abap +0 -53
  90. package/abap/zif_abgagt_agent.intf.xml +0 -15
  91. package/abap/zif_abgagt_cmd_factory.intf.abap +0 -7
  92. package/abap/zif_abgagt_cmd_factory.intf.xml +0 -15
  93. package/abap/zif_abgagt_command.intf.abap +0 -26
  94. package/abap/zif_abgagt_command.intf.xml +0 -15
  95. package/abap/zif_abgagt_util.intf.abap +0 -28
  96. package/abap/zif_abgagt_util.intf.xml +0 -15
  97. package/abap/zif_abgagt_viewer.intf.abap +0 -12
  98. package/abap/zif_abgagt_viewer.intf.xml +0 -15
  99. package/docs/commands.md +0 -142
  100. package/docs/create-command.md +0 -129
  101. package/docs/health-command.md +0 -89
  102. package/docs/import-command.md +0 -195
  103. package/docs/init-command.md +0 -189
  104. package/docs/inspect-command.md +0 -169
  105. package/docs/list-command.md +0 -289
  106. package/docs/preview-command.md +0 -528
  107. package/docs/pull-command.md +0 -202
  108. package/docs/status-command.md +0 -68
  109. package/docs/tree-command.md +0 -303
  110. package/docs/unit-command.md +0 -167
  111. package/docs/view-command.md +0 -501
  112. package/img/claude.png +0 -0
  113. package/scripts/claude-integration.js +0 -351
  114. package/scripts/release.js +0 -298
  115. package/scripts/release.sh +0 -60
  116. package/scripts/test-integration.js +0 -139
  117. package/scripts/unrelease.js +0 -277
@@ -1,139 +0,0 @@
1
- /**
2
- * Simple integration test for Claude
3
- * Run: node scripts/test-integration.js
4
- */
5
-
6
- const http = require('http');
7
- const https = require('https');
8
-
9
- /**
10
- * Mock ABAP response for testing without actual ABAP system
11
- */
12
- function mockAbapResponse(success = true) {
13
- if (success) {
14
- return {
15
- success: 'X',
16
- job_id: 'TEST123_20260206_120000',
17
- message: 'Pull completed successfully',
18
- error_detail: null
19
- };
20
- } else {
21
- return {
22
- success: '',
23
- job_id: 'TEST123_20260206_120000',
24
- message: 'Pull completed with errors',
25
- error_detail: 'Errors/Warnings:\n - CLAS ZCL_TEST: Syntax error in line 15\n - PROG ZTEST_REPORT: Unknown variable'
26
- };
27
- }
28
- }
29
-
30
- /**
31
- * Test the response parsing logic
32
- */
33
- function testResponseParsing() {
34
- console.log('\n🧪 Testing Response Parsing...\n');
35
-
36
- // Test success response
37
- const successResponse = mockAbapResponse(true);
38
- console.log('✅ Success Response:');
39
- console.log(JSON.stringify(successResponse, null, 2));
40
-
41
- const successResult = {
42
- success: successResponse.success === 'X' || successResponse.success === true,
43
- job_id: successResponse.job_id,
44
- message: successResponse.message,
45
- error_detail: successResponse.error_detail
46
- };
47
-
48
- console.log('\nParsed:');
49
- console.log(JSON.stringify(successResult, null, 2));
50
-
51
- // Test error response
52
- const errorResponse = mockAbapResponse(false);
53
- console.log('\n❌ Error Response:');
54
- console.log(JSON.stringify(errorResponse, null, 2));
55
-
56
- const errorResult = {
57
- success: errorResponse.success === 'X' || errorResponse.success === true,
58
- job_id: errorResponse.job_id,
59
- message: errorResponse.message,
60
- error_detail: errorResponse.error_detail
61
- };
62
-
63
- console.log('\nParsed:');
64
- console.log(JSON.stringify(errorResult, null, 2));
65
-
66
- // Verify parsing
67
- if (successResult.success === true && errorResult.success === false) {
68
- console.log('\n✅ Response parsing works correctly!');
69
- return true;
70
- } else {
71
- console.log('\n❌ Response parsing failed!');
72
- return false;
73
- }
74
- }
75
-
76
- /**
77
- * Test URL construction
78
- */
79
- function testUrlConstruction() {
80
- console.log('\n🧪 Testing URL Construction...\n');
81
-
82
- const config = {
83
- host: 'your-sap-system.com',
84
- sapport: 44300,
85
- client: '100',
86
- user: 'TECH_USER',
87
- password: 'secret',
88
- language: 'EN'
89
- };
90
-
91
- const expectedUrl = `https://${config.host}:${config.sapport}/sap/bc/z_abapgit_agent/pull`;
92
- console.log(`Expected URL: ${expectedUrl}`);
93
- console.log('✅ URL construction logic is correct');
94
-
95
- return true;
96
- }
97
-
98
- /**
99
- * Test error detail formatting
100
- */
101
- function testErrorDetailFormatting() {
102
- console.log('\n🧪 Testing Error Detail Formatting...\n');
103
-
104
- const errorDetail = `Errors/Warnings:
105
- - CLAS ZCL_TEST: Syntax error in line 15
106
- - PROG ZTEST_REPORT: Unknown variable`;
107
-
108
- console.log('Error Detail Output:');
109
- console.log(errorDetail);
110
- console.log('\n✅ Error formatting works correctly');
111
-
112
- return true;
113
- }
114
-
115
- /**
116
- * Main test runner
117
- */
118
- function main() {
119
- console.log('='.repeat(50));
120
- console.log('ABAP AI Bridge - Integration Tests');
121
- console.log('='.repeat(50));
122
-
123
- const results = [];
124
-
125
- results.push(testResponseParsing());
126
- results.push(testUrlConstruction());
127
- results.push(testErrorDetailFormatting());
128
-
129
- console.log('\n' + '='.repeat(50));
130
- if (results.every(r => r === true)) {
131
- console.log('✅ All tests passed!');
132
- process.exit(0);
133
- } else {
134
- console.log('❌ Some tests failed!');
135
- process.exit(1);
136
- }
137
- }
138
-
139
- main();
@@ -1,277 +0,0 @@
1
- /**
2
- * Unrelease script - Remove a release
3
- *
4
- * Usage: npm run unrelease [version] [--dry-run]
5
- *
6
- * Options:
7
- * --dry-run Test the unrelease flow without making actual changes
8
- *
9
- * This script:
10
- * 1. Takes a version as argument (default: current version from package.json)
11
- * 2. Deletes the GitHub release
12
- * 3. Deletes the git tag
13
- * 4. Removes release notes from RELEASE_NOTES.md
14
- * 5. Restores version in local files (or shows what would be restored in dry-run)
15
- * 6. Removes release commits from git history (top 2 commits if they match release pattern)
16
- */
17
-
18
- const fs = require('fs');
19
- const path = require('path');
20
- const { execSync } = require('child_process');
21
-
22
- const packageJsonPath = path.join(__dirname, '..', 'package.json');
23
- const releaseNotesPath = path.join(__dirname, '..', 'RELEASE_NOTES.md');
24
- const repoRoot = path.join(__dirname, '..');
25
-
26
- // Get version from argument or package.json
27
- let version = process.argv[2];
28
-
29
- // Check for --dry-run flag
30
- const args = process.argv.slice(2);
31
- const dryRun = args.includes('--dry-run');
32
-
33
- // Remove version and dry-run from args to get clean list
34
- const remainingArgs = args.filter(arg => arg !== '--dry-run' && !arg.startsWith('--'));
35
- if (!version && remainingArgs.length > 0) {
36
- version = remainingArgs[0];
37
- }
38
-
39
- if (!version) {
40
- const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
41
- version = pkg.version;
42
- }
43
-
44
- // Ensure version has 'v' prefix for tag
45
- const versionTag = version.startsWith('v') ? version : `v${version}`;
46
- const versionNoV = version.startsWith('v') ? version.slice(1) : version;
47
-
48
- if (dryRun) {
49
- console.log('🔹 DRY RUN MODE - No actual changes will be made\n');
50
- }
51
-
52
- console.log(`Unreleasing version: ${versionNoV} (tag: ${versionTag})`);
53
- console.log('');
54
-
55
- // Check if there's a remote for github.com
56
- let remoteName = 'origin';
57
- try {
58
- const remotes = execSync('git remote -v', { cwd: repoRoot, encoding: 'utf8' });
59
- if (remotes.includes('public') && remotes.includes('github.com')) {
60
- remoteName = 'public';
61
- }
62
- console.log(`Using remote: ${remoteName}`);
63
- } catch (e) {
64
- console.log('Could not determine remote, using origin');
65
- }
66
-
67
- console.log('');
68
-
69
- // Step 1: Delete GitHub release
70
- if (dryRun) {
71
- console.log(`🔹 DRY RUN - Would delete GitHub release: ${versionTag}`);
72
- } else {
73
- console.log('Deleting GitHub release...');
74
- try {
75
- execSync(`gh release delete ${versionTag} --repo SylvosCai/abapgit-agent --yes`, { cwd: repoRoot, encoding: 'utf8' });
76
- console.log('✅ GitHub release deleted');
77
- } catch (e) {
78
- console.log('⚠️ GitHub release not found or already deleted');
79
- }
80
- }
81
- console.log('');
82
-
83
- // Step 2: Delete git tag locally and remotely
84
- if (dryRun) {
85
- console.log(`🔹 DRY RUN - Would delete git tag: ${versionTag}`);
86
- } else {
87
- console.log('Deleting git tag...');
88
- try {
89
- execSync(`git tag -d ${versionTag}`, { cwd: repoRoot, encoding: 'utf8' });
90
- console.log('✅ Local tag deleted');
91
- } catch (e) {
92
- console.log('⚠️ Local tag not found');
93
- }
94
-
95
- try {
96
- execSync(`git push ${remoteName} --delete ${versionTag}`, { cwd: repoRoot, encoding: 'utf8' });
97
- console.log('✅ Remote tag deleted');
98
- } catch (e) {
99
- console.log('⚠️ Remote tag not found or already deleted');
100
- }
101
- }
102
- console.log('');
103
-
104
- // Step 3: Remove release notes from RELEASE_NOTES.md
105
- if (dryRun) {
106
- console.log(`🔹 DRY RUN - Would remove release notes for v${versionNoV} from RELEASE_NOTES.md`);
107
- } else {
108
- console.log('Removing release notes from RELEASE_NOTES.md...');
109
- if (fs.existsSync(releaseNotesPath)) {
110
- let content = fs.readFileSync(releaseNotesPath, 'utf8');
111
-
112
- // Check if version exists in release notes
113
- const versionHeader = `## v${versionNoV}`;
114
- if (content.includes(versionHeader)) {
115
- // Remove the version section (from ## vX.X.X to next --- or end)
116
- const lines = content.split('\n');
117
- const newLines = [];
118
- let inVersionSection = false;
119
- let foundVersion = false;
120
-
121
- for (let i = 0; i < lines.length; i++) {
122
- const line = lines[i];
123
-
124
- // Match exactly the version header (e.g., ## v1.4.1)
125
- if (line.trim() === versionHeader) {
126
- inVersionSection = true;
127
- foundVersion = true;
128
- continue;
129
- }
130
-
131
- if (inVersionSection) {
132
- // Stop at next --- separator or exact version header
133
- if (line.startsWith('---')) {
134
- inVersionSection = false;
135
- newLines.push(line);
136
- } else if (line.trim().startsWith('## v')) {
137
- // Check if it's another exact version header (e.g., ## v1.4.0)
138
- const trimmed = line.trim();
139
- if (trimmed.match(/^## v\d+\.\d+\.\d+$/)) {
140
- inVersionSection = false;
141
- newLines.push(line);
142
- }
143
- }
144
- // Otherwise skip this line (part of the version section)
145
- } else {
146
- newLines.push(line);
147
- }
148
- }
149
-
150
- if (foundVersion) {
151
- fs.writeFileSync(releaseNotesPath, newLines.join('\n').trim() + '\n');
152
- console.log('✅ Release notes removed');
153
- } else {
154
- console.log('⚠️ Version not found in RELEASE_NOTES.md');
155
- }
156
- } else {
157
- console.log('⚠️ Version not found in RELEASE_NOTES.md');
158
- }
159
- } else {
160
- console.log('⚠️ RELEASE_NOTES.md not found');
161
- }
162
- }
163
- console.log('');
164
-
165
- // Step 4: Restore version in package.json and abap health resource
166
- console.log('Restoring version in local files...');
167
-
168
- // Restore package.json to previous version (find previous tag)
169
- const allTags = execSync('git tag --sort=-v:refname', { cwd: repoRoot, encoding: 'utf8' });
170
- const tagList = allTags.trim().split('\n').filter(t => t.startsWith('v') && t !== versionTag);
171
- const previousTag = tagList[0];
172
-
173
- if (previousTag) {
174
- // In dry-run mode, still restore files but don't commit
175
- if (dryRun) {
176
- try {
177
- execSync(`git show ${previousTag}:package.json > ${packageJsonPath}`, { cwd: repoRoot, encoding: 'utf8' });
178
- console.log(`🔹 DRY RUN - Restored package.json from ${previousTag}`);
179
- } catch (e) {
180
- console.log('⚠️ Could not restore package.json');
181
- }
182
-
183
- try {
184
- execSync(`git show ${previousTag}:abap/zcl_abgagt_resource_health.clas.abap > abap/zcl_abgagt_resource_health.clas.abap`, { cwd: repoRoot, encoding: 'utf8' });
185
- console.log(`🔹 DRY RUN - Restored ABAP health resource from ${previousTag}`);
186
- } catch (e) {
187
- console.log('⚠️ Could not restore ABAP health resource');
188
- }
189
- } else {
190
- try {
191
- execSync(`git show ${previousTag}:package.json > ${packageJsonPath}`, { cwd: repoRoot, encoding: 'utf8' });
192
- console.log('✅ package.json restored to previous version');
193
- } catch (e) {
194
- console.log('⚠️ Could not restore package.json');
195
- }
196
-
197
- try {
198
- execSync(`git show ${previousTag}:abap/zcl_abgagt_resource_health.clas.abap > abap/zcl_abgagt_resource_health.clas.abap`, { cwd: repoRoot, encoding: 'utf8' });
199
- console.log('✅ ABAP health resource restored to previous version');
200
- } catch (e) {
201
- console.log('⚠️ Could not restore ABAP health resource');
202
- }
203
- }
204
- } else {
205
- console.log('⚠️ No previous tag found, cannot restore version');
206
- }
207
- console.log('');
208
-
209
- // Step 5: Remove release commits from remote if they exist
210
- // Pattern: "chore: release vX.X.X" followed by "X.X.X"
211
- console.log('Checking for release commits on remote...');
212
- try {
213
- // Get top 2 commit messages from remote
214
- let remoteRef;
215
- try {
216
- remoteRef = execSync(`git rev-parse ${remoteName}/master 2>/dev/null`, { cwd: repoRoot, encoding: 'utf8' }).trim();
217
- } catch (e) {
218
- try {
219
- remoteRef = execSync(`git rev-parse ${remoteName}/main 2>/dev/null`, { cwd: repoRoot, encoding: 'utf8' }).trim();
220
- } catch (e2) {
221
- remoteRef = '';
222
- }
223
- }
224
-
225
- if (!remoteRef) {
226
- console.log('⚠️ Could not determine remote ref');
227
- } else {
228
- // Get top 2 commits from remote
229
- const remoteTopCommits = execSync(`git log ${remoteRef} -2 --format="%s"`, { cwd: repoRoot, encoding: 'utf8' }).trim().split('\n');
230
-
231
- if (remoteTopCommits.length >= 2) {
232
- const firstCommit = remoteTopCommits[0]; // Most recent on remote
233
- const secondCommit = remoteTopCommits[1]; // Second most recent on remote
234
-
235
- // Check if they match the expected pattern
236
- // firstCommit (HEAD) = "chore: release vX.X.X"
237
- // secondCommit (HEAD~1) = "X.X.X" (just version number)
238
- const isReleaseCommit = firstCommit && firstCommit.match(/^chore: release v\d+\.\d+\.\d+$/);
239
- const isVersionBump = secondCommit && secondCommit.match(/^\d+\.\d+\.\d+$/);
240
-
241
- if (isReleaseCommit && isVersionBump) {
242
- // Found release commits on remote - need to force push to remove them
243
- // Find the commit to reset to (before the version bump)
244
- const resetToRef = execSync(`git rev-parse ${remoteRef}~2`, { cwd: repoRoot, encoding: 'utf8' }).trim();
245
-
246
- if (dryRun) {
247
- console.log(`🔹 DRY RUN - Would force push to remove release commits from remote`);
248
- console.log(` Would remove: "${firstCommit}" and "${secondCommit}"`);
249
- console.log(` Would reset remote to: ${resetToRef.slice(0, 7)}`);
250
- } else {
251
- // Reset to the commit before release, then force push
252
- execSync(`git reset --hard ${resetToRef}`, { cwd: repoRoot });
253
- console.log('✅ Reset to commit before release');
254
-
255
- // Force push to remove from remote
256
- console.log('Force pushing to remote...');
257
- execSync(`git push ${remoteName} +HEAD --force`, { cwd: repoRoot });
258
- console.log('✅ Force pushed to remote - release commits removed from history');
259
- }
260
- } else {
261
- console.log('⚠️ Remote top commits do not match release pattern, skipping');
262
- console.log(` Found: "${firstCommit}" and "${secondCommit}"`);
263
- }
264
- } else {
265
- console.log('⚠️ Not enough commits on remote to check');
266
- }
267
- }
268
- } catch (e) {
269
- console.log('⚠️ Could not check/remove release commits:', e.message);
270
- }
271
- console.log('');
272
-
273
- if (dryRun) {
274
- console.log('🔹 DRY RUN COMPLETE - No actual changes made');
275
- } else {
276
- console.log('Done!');
277
- }