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.
package/bin/abapgit-agent CHANGED
@@ -3,6 +3,9 @@
3
3
  * ABAP Git Agent - CLI Tool
4
4
  *
5
5
  * Usage:
6
+ * abapgit-agent init --folder <folder> --package <package>
7
+ * abapgit-agent create
8
+ * abapgit-agent import [--message <message>]
6
9
  * abapgit-agent pull [--branch <branch>]
7
10
  * abapgit-agent pull --url <git-url> [--branch <branch>]
8
11
  * abapgit-agent health
@@ -147,7 +150,7 @@ function saveCookies(cookies, host) {
147
150
  }
148
151
 
149
152
  /**
150
- * Fetch CSRF token using GET /pull with X-CSRF-Token: fetch
153
+ * Fetch CSRF token using GET /health with X-CSRF-Token: fetch
151
154
  */
152
155
  async function fetchCsrfToken(config) {
153
156
  const https = require('https');
@@ -696,6 +699,150 @@ async function pull(gitUrl, branch = 'main', files = null, transportRequest = nu
696
699
  }
697
700
  }
698
701
 
702
+ /**
703
+ * Run init command - Initialize local configuration
704
+ */
705
+ async function runInit(args) {
706
+ const folderArgIndex = args.indexOf('--folder');
707
+ const packageArgIndex = args.indexOf('--package');
708
+
709
+ // Get parameters
710
+ const folder = folderArgIndex !== -1 && folderArgIndex + 1 < args.length
711
+ ? args[folderArgIndex + 1]
712
+ : '/src/';
713
+
714
+ const packageName = packageArgIndex !== -1 && packageArgIndex + 1 < args.length
715
+ ? args[packageArgIndex + 1]
716
+ : null;
717
+
718
+ // Validate package is required
719
+ if (!packageName) {
720
+ console.error('Error: --package is required');
721
+ console.error('Usage: abapgit-agent init --folder /src --package ZMY_PACKAGE');
722
+ process.exit(1);
723
+ }
724
+
725
+ console.log(`\nšŸš€ Initializing abapGit Agent for local repository`);
726
+ console.log(` Folder: ${folder}`);
727
+ console.log(` Package: ${packageName}`);
728
+ console.log('');
729
+
730
+ // Check if current folder is git repo root
731
+ const gitDir = pathModule.join(process.cwd(), '.git');
732
+ if (!fs.existsSync(gitDir)) {
733
+ console.error('Error: Current folder is not a git repository.');
734
+ console.error('Run this command from the root folder of your git repository.');
735
+ process.exit(1);
736
+ }
737
+
738
+ // Detect git remote URL
739
+ const gitUrl = getGitRemoteUrl();
740
+ if (!gitUrl) {
741
+ console.error('Error: No git remote configured.');
742
+ console.error('Configure a remote with: git remote add origin <url>');
743
+ process.exit(1);
744
+ }
745
+ console.log(`šŸ“Œ Git remote: ${gitUrl}`);
746
+
747
+ // Check if .abapGitAgent already exists
748
+ const configPath = pathModule.join(process.cwd(), '.abapGitAgent');
749
+ if (fs.existsSync(configPath)) {
750
+ console.error('Error: .abapGitAgent already exists.');
751
+ console.error('To reinitialize, delete the existing file first.');
752
+ process.exit(1);
753
+ }
754
+
755
+ // Copy .abapGitAgent.example to .abapGitAgent
756
+ const samplePath = pathModule.join(__dirname, '..', '.abapGitAgent.example');
757
+ if (!fs.existsSync(samplePath)) {
758
+ console.error('Error: .abapGitAgent.example not found.');
759
+ process.exit(1);
760
+ }
761
+
762
+ try {
763
+ // Read sample and update with package/folder
764
+ const sampleContent = fs.readFileSync(samplePath, 'utf8');
765
+ const config = JSON.parse(sampleContent);
766
+ config.package = packageName;
767
+ config.folder = folder;
768
+
769
+ // Write updated config
770
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
771
+ console.log(`āœ… Created .abapGitAgent`);
772
+ } catch (error) {
773
+ console.error(`Error creating .abapGitAgent: ${error.message}`);
774
+ process.exit(1);
775
+ }
776
+
777
+ // Update .gitignore
778
+ const gitignorePath = pathModule.join(process.cwd(), '.gitignore');
779
+ const ignoreEntries = ['.abapGitAgent', '.abapgit_agent_cookies.txt'];
780
+ let existingIgnore = '';
781
+
782
+ if (fs.existsSync(gitignorePath)) {
783
+ existingIgnore = fs.readFileSync(gitignorePath, 'utf8');
784
+ }
785
+
786
+ let updated = false;
787
+ let newIgnoreContent = existingIgnore;
788
+
789
+ for (const entry of ignoreEntries) {
790
+ if (!newIgnoreContent.includes(entry)) {
791
+ if (newIgnoreContent && !newIgnoreContent.endsWith('\n')) {
792
+ newIgnoreContent += '\n';
793
+ }
794
+ newIgnoreContent += entry + '\n';
795
+ updated = true;
796
+ }
797
+ }
798
+
799
+ if (updated) {
800
+ fs.writeFileSync(gitignorePath, newIgnoreContent);
801
+ console.log(`āœ… Updated .gitignore`);
802
+ } else {
803
+ fs.writeFileSync(gitignorePath, newIgnoreContent);
804
+ console.log(`āœ… .gitignore already up to date`);
805
+ }
806
+
807
+ // Copy CLAUDE.md
808
+ const claudeMdPath = pathModule.join(__dirname, '..', 'abap', 'CLAUDE.md');
809
+ const localClaudeMdPath = pathModule.join(process.cwd(), 'CLAUDE.md');
810
+ try {
811
+ if (fs.existsSync(claudeMdPath)) {
812
+ fs.copyFileSync(claudeMdPath, localClaudeMdPath);
813
+ console.log(`āœ… Created CLAUDE.md`);
814
+ } else {
815
+ console.log(`āš ļø CLAUDE.md not found in abap/ directory`);
816
+ }
817
+ } catch (error) {
818
+ console.error(`Error copying CLAUDE.md: ${error.message}`);
819
+ }
820
+
821
+ // Create folder
822
+ const folderPath = pathModule.join(process.cwd(), folder);
823
+ try {
824
+ if (!fs.existsSync(folderPath)) {
825
+ fs.mkdirSync(folderPath, { recursive: true });
826
+ console.log(`āœ… Created folder: ${folder}`);
827
+
828
+ // Create .gitkeep
829
+ const gitkeepPath = pathModule.join(folderPath, '.gitkeep');
830
+ fs.writeFileSync(gitkeepPath, '');
831
+ } else {
832
+ console.log(`āœ… Folder already exists: ${folder}`);
833
+ }
834
+ } catch (error) {
835
+ console.error(`Error creating folder: ${error.message}`);
836
+ }
837
+
838
+ console.log(`
839
+ šŸ“‹ Next steps:
840
+ 1. Edit .abapGitAgent with your ABAP credentials (host, user, password)
841
+ 2. Run 'abapgit-agent create --import' to create online repository
842
+ 3. Run 'abapgit-agent pull' to activate objects
843
+ `);
844
+ }
845
+
699
846
  /**
700
847
  * Check agent health
701
848
  */
@@ -718,8 +865,10 @@ async function main() {
718
865
  const command = args[0];
719
866
 
720
867
  // Check if ABAP integration is enabled for this repo
721
- if (!isAbapIntegrationEnabled()) {
722
- console.log(`
868
+ // (skip for init, help commands)
869
+ if (command && command !== 'init' && command !== 'help' && command !== '--help' && command !== '-h') {
870
+ if (!isAbapIntegrationEnabled()) {
871
+ console.log(`
723
872
  āš ļø ABAP Git Agent not configured for this repository.
724
873
 
725
874
  To enable integration:
@@ -736,13 +885,195 @@ To enable integration:
736
885
  2. Or set environment variables:
737
886
  - ABAP_HOST, ABAP_PORT, ABAP_CLIENT, ABAP_USER, ABAP_PASSWORD
738
887
  `);
739
- if (command !== 'help' && command !== '--help' && command !== '-h') {
740
888
  process.exit(1);
741
889
  }
742
890
  }
743
891
 
744
892
  try {
745
893
  switch (command) {
894
+ case 'init':
895
+ await runInit(args);
896
+ return; // Don't check ABAP integration for init
897
+
898
+ case 'create': {
899
+ const helpIndex = args.findIndex(a => a === '--help' || a === '-h');
900
+
901
+ // Show help if requested
902
+ if (helpIndex !== -1) {
903
+ console.log(`
904
+ Usage:
905
+ abapgit-agent create
906
+
907
+ Description:
908
+ Create abapGit online repository in ABAP system.
909
+ Auto-detects URL from git remote and package from .abapGitAgent.
910
+
911
+ Prerequisites:
912
+ - Run "abapgit-agent init" first
913
+ - Edit .abapGitAgent with credentials (host, user, password)
914
+
915
+ Examples:
916
+ abapgit-agent create # Create repo in ABAP
917
+ `);
918
+ return;
919
+ }
920
+
921
+ // Get parameters from config
922
+ const config = loadConfig();
923
+ const repoUrl = getGitRemoteUrl();
924
+
925
+ if (!repoUrl) {
926
+ console.error('Error: No git remote configured. Please configure a remote origin.');
927
+ process.exit(1);
928
+ }
929
+
930
+ if (!config.package) {
931
+ console.error('Error: Package not configured. Run "abapgit-agent init" first or set package in .abapGitAgent.');
932
+ process.exit(1);
933
+ }
934
+
935
+ const branch = getGitBranch();
936
+
937
+ // Extract repo name from git URL
938
+ const repoName = repoUrl.split('/').pop().replace('.git', '');
939
+
940
+ console.log(`\nšŸš€ Creating online repository`);
941
+ console.log(` URL: ${repoUrl}`);
942
+ console.log(` Package: ${config.package}`);
943
+ console.log(` Folder: ${config.folder || '/src/'}`);
944
+ console.log(` Name: ${repoName}`);
945
+ console.log(` Branch: ${branch}`);
946
+
947
+ const csrfToken = await fetchCsrfToken(config);
948
+
949
+ const data = {
950
+ url: repoUrl,
951
+ package: config.package,
952
+ name: repoName,
953
+ branch: branch,
954
+ folder: config.folder || '/src/'
955
+ };
956
+
957
+ if (config.gitUsername) {
958
+ data.username = config.gitUsername;
959
+ }
960
+
961
+ if (config.gitPassword) {
962
+ data.password = config.gitPassword;
963
+ }
964
+
965
+ const result = await request('POST', '/sap/bc/z_abapgit_agent/create', data, { csrfToken });
966
+
967
+ console.log('\n');
968
+
969
+ // Handle uppercase keys from ABAP
970
+ const success = result.SUCCESS || result.success;
971
+ const repoKey = result.REPO_KEY || result.repo_key;
972
+ const createdRepoName = result.REPO_NAME || result.repo_name;
973
+ const message = result.MESSAGE || result.message;
974
+ const error = result.ERROR || result.error;
975
+
976
+ if (success === 'X' || success === true) {
977
+ console.log(`āœ… Repository created successfully!`);
978
+ console.log(` URL: ${repoUrl}`);
979
+ console.log(` Package: ${config.package}`);
980
+ console.log(` Name: ${createdRepoName || repoName}`);
981
+ } else {
982
+ console.log(`āŒ Failed to create repository`);
983
+ console.log(` Error: ${error || message || 'Unknown error'}`);
984
+ process.exit(1);
985
+ }
986
+ break;
987
+ }
988
+
989
+ case 'import': {
990
+ const helpIndex = args.findIndex(a => a === '--help' || a === '-h');
991
+
992
+ // Show help if requested
993
+ if (helpIndex !== -1) {
994
+ console.log(`
995
+ Usage:
996
+ abapgit-agent import [--message <message>]
997
+
998
+ Description:
999
+ Import existing objects from package to git repository.
1000
+ Uses the git remote URL to find the abapGit online repository.
1001
+
1002
+ Prerequisites:
1003
+ - Run "abapgit-agent create" first or create repository in abapGit UI
1004
+ - Package must have objects to import
1005
+
1006
+ Options:
1007
+ --message Commit message (default: "feat: initial import from ABAP package <package>")
1008
+
1009
+ Examples:
1010
+ abapgit-agent import
1011
+ abapgit-agent import --message "Initial import from SAP"
1012
+ `);
1013
+ return;
1014
+ }
1015
+
1016
+ // Get parameters from config
1017
+ const config = loadConfig();
1018
+ const repoUrl = getGitRemoteUrl();
1019
+
1020
+ if (!repoUrl) {
1021
+ console.error('Error: No git remote configured. Please configure a remote origin.');
1022
+ process.exit(1);
1023
+ }
1024
+
1025
+ const messageArgIndex = args.indexOf('--message');
1026
+ let commitMessage = null;
1027
+ if (messageArgIndex !== -1 && messageArgIndex + 1 < args.length) {
1028
+ commitMessage = args[messageArgIndex + 1];
1029
+ }
1030
+
1031
+ console.log(`\nšŸ“¦ Importing objects to git repository`);
1032
+ console.log(` URL: ${repoUrl}`);
1033
+ if (commitMessage) {
1034
+ console.log(` Message: ${commitMessage}`);
1035
+ }
1036
+
1037
+ const csrfToken = await fetchCsrfToken(config);
1038
+
1039
+ const data = {
1040
+ url: repoUrl
1041
+ };
1042
+
1043
+ if (commitMessage) {
1044
+ data.message = commitMessage;
1045
+ }
1046
+
1047
+ if (config.gitUsername) {
1048
+ data.username = config.gitUsername;
1049
+ }
1050
+
1051
+ if (config.gitPassword) {
1052
+ data.password = config.gitPassword;
1053
+ }
1054
+
1055
+ const result = await request('POST', '/sap/bc/z_abapgit_agent/import', data, { csrfToken });
1056
+
1057
+ console.log('\n');
1058
+
1059
+ // Handle uppercase keys from ABAP
1060
+ const success = result.SUCCESS || result.success;
1061
+ const filesStaged = result.FILES_STAGED || result.files_staged;
1062
+ const abapCommitMessage = result.COMMIT_MESSAGE || result.commit_message;
1063
+ const error = result.ERROR || result.error;
1064
+
1065
+ if (success === 'X' || success === true) {
1066
+ console.log(`āœ… Objects imported successfully!`);
1067
+ console.log(` Files staged: ${filesStaged}`);
1068
+ console.log(` Commit: ${commitMessage || abapCommitMessage}`);
1069
+ } else {
1070
+ console.log(`āŒ Import failed`);
1071
+ console.log(` Error: ${error || resultMessage || 'Unknown error'}`);
1072
+ process.exit(1);
1073
+ }
1074
+ break;
1075
+ }
1076
+
746
1077
  case 'pull':
747
1078
  const urlArgIndex = args.indexOf('--url');
748
1079
  const branchArgIndex = args.indexOf('--branch');
@@ -852,6 +1183,17 @@ Usage:
852
1183
  abapgit-agent <command> [options]
853
1184
 
854
1185
  Commands:
1186
+ init --folder <folder> --package <package>
1187
+ Initialize local configuration for an existing git repository.
1188
+
1189
+ create
1190
+ Create abapGit online repository in ABAP system.
1191
+ Auto-detects URL from git remote and package from .abapGitAgent.
1192
+
1193
+ import [--message <message>]
1194
+ Import existing objects from package to git repository.
1195
+ Uses the git remote URL to find the abapGit online repository.
1196
+
855
1197
  pull [--url <git-url>] [--branch <branch>] [--files <file1,file2,...>] [--transport <request>]
856
1198
  Pull and activate repository in ABAP system.
857
1199
  Auto-detects git remote and branch from current directory.
@@ -864,9 +1206,6 @@ Commands:
864
1206
  unit --files <file1>,<file2>,...
865
1207
  Run AUnit tests for ABAP test class files (.testclasses.abap)
866
1208
 
867
- unit --object <type> <name>
868
- Run unit tests for a specific object.
869
-
870
1209
  health
871
1210
  Check if ABAP REST API is healthy
872
1211
 
@@ -874,15 +1213,16 @@ Commands:
874
1213
  Check if ABAP integration is configured for this repo
875
1214
 
876
1215
  Examples:
877
- abapgit-agent pull # Auto-detect from git repo
878
- abapgit-agent pull --branch develop # Use specific branch
879
- abapgit-agent pull --files zcl_my_class.clas.abap # Pull specific file
880
- abapgit-agent pull --transport DEVK900001 # Use specific transport request
881
- abapgit-agent pull --files zcl_my_class.clas.abap --transport DEVK900001
882
- abapgit-agent inspect --files zcl_my_class.clas.abap # Inspect syntax
883
- abapgit-agent inspect --files zcl_my_class.clas.abap,zcl_other.clas.abap
884
- abapgit-agent unit --files zcl_my_test.clas.testclasses.abap
885
- abapgit-agent unit --files zcl_my_test.clas.testclasses.abap,zcl_other.clas.testclasses.abap
1216
+ abapgit-agent init --folder /src --package ZMY_PACKAGE # Initialize
1217
+ abapgit-agent create # Create repo
1218
+ abapgit-agent import # Import objects to git
1219
+ abapgit-agent import --message "Initial import" # Import with message
1220
+ abapgit-agent pull # Auto-detect from git
1221
+ abapgit-agent pull --branch develop # Specific branch
1222
+ abapgit-agent pull --files zcl_my_class.clas.abap # Specific file
1223
+ abapgit-agent pull --transport DEVK900001 # With transport
1224
+ abapgit-agent inspect --files zcl_my_class.clas.abap # Syntax check
1225
+ abapgit-agent unit --files zcl_my_test.clas.testclasses.abap # Run tests
886
1226
  abapgit-agent health
887
1227
  abapgit-agent status
888
1228
  `);
@@ -0,0 +1,118 @@
1
+ # Commands Overview
2
+
3
+ All available CLI commands for abapGit Agent.
4
+
5
+ ## Command Reference
6
+
7
+ | Command | Status | Description |
8
+ |---------|--------|-------------|
9
+ | [init](init-command.md) | āœ… | Initialize local configuration |
10
+ | [create](create-command.md) | āœ… | Create online repository in ABAP |
11
+ | [import](import-command.md) | āœ… | Import objects from ABAP package to git |
12
+ | [pull](pull-command.md) | āœ… | Pull and activate objects in ABAP |
13
+ | [inspect](inspect-command.md) | āœ… | Syntax check ABAP source files |
14
+ | [unit](unit-command.md) | āœ… | Run AUnit tests |
15
+ | [health](health-command.md) | āœ… | Health check |
16
+ | [status](status-command.md) | āœ… | Status check |
17
+
18
+ ---
19
+
20
+ ## Quick Start
21
+
22
+ ### New Project Setup
23
+
24
+ ```bash
25
+ # 1. Initialize local configuration
26
+ abapgit-agent init --folder /src --package ZMY_PACKAGE
27
+
28
+ # 2. Edit .abapGitAgent with credentials
29
+ vim .abapGitAgent
30
+
31
+ # 3. Create online repository in ABAP
32
+ abapgit-agent create
33
+
34
+ # 4. Import objects from ABAP package to git
35
+ abapgit-agent import
36
+
37
+ # 5. Push to git
38
+ git push origin main
39
+
40
+ # 6. Activate in ABAP
41
+ abapgit-agent pull
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Daily Development
47
+
48
+ ```bash
49
+ # Pull changes from git and activate in ABAP (auto-detects git remote)
50
+ abapgit-agent pull
51
+
52
+ # Pull specific files only (faster for small changes)
53
+ abapgit-agent pull --files abap/zcl_my_class.clas.abap
54
+
55
+ # Syntax check before commit
56
+ abapgit-agent inspect --files abap/zcl_my_class.clas.abap
57
+
58
+ # Run unit tests
59
+ abapgit-agent unit --files abap/zcl_my_test.clas.testclasses.abap
60
+
61
+ # Check configuration
62
+ abapgit-agent status
63
+
64
+ # Verify ABAP connection
65
+ abapgit-agent health
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Command Workflow
71
+
72
+ ```
73
+ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
74
+ │ init │
75
+ │ └── Creates .abapGitAgent, CLAUDE.md, /src/ │
76
+ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
77
+ │
78
+ ā–¼
79
+ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
80
+ │ create │
81
+ │ └── Creates online repo in ABAP │
82
+ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
83
+ │
84
+ ā–¼
85
+ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
86
+ │ import │
87
+ │ └── Stages, commits, pushes objects to git │
88
+ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
89
+ │
90
+ ā–¼
91
+ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
92
+ │ git push │
93
+ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
94
+ │
95
+ ā–¼
96
+ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
97
+ │ pull │
98
+ │ └── Activates objects in ABAP │
99
+ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Common Options
105
+
106
+ ### Global Parameters
107
+
108
+ All commands read configuration from:
109
+ - `.abapGitAgent` file in current directory
110
+ - Environment variables (`ABAP_HOST`, `ABAP_USER`, etc.)
111
+
112
+ ### File Patterns
113
+
114
+ | Pattern | Description |
115
+ |---------|-------------|
116
+ | `zcl_my_class.clas.abap` | ABAP class source |
117
+ | `zif_my_intf.intf.abap` | ABAP interface source |
118
+ | `zcl_my_test.clas.testclasses.abap` | ABAP test class |
@@ -0,0 +1,129 @@
1
+ # create Command
2
+
3
+ Create a new abapGit online repository in the ABAP system.
4
+
5
+ ## Command
6
+
7
+ ```bash
8
+ abapgit-agent create
9
+ ```
10
+
11
+ ## Prerequisite
12
+
13
+ - `init` command has been run successfully
14
+ - `.abapGitAgent` file exists with credentials (host, user, password, gitUsername, gitPassword)
15
+ - Current folder is git repo root
16
+
17
+ ## What It Does
18
+
19
+ 1. **Detect git remote** - Gets URL from `git remote get-url origin`
20
+ 2. **Get package** - Reads from `.abapGitAgent`
21
+ 3. **Get folder** - Reads from `.abapGitAgent` (default: `/src/`)
22
+ 4. **Create repository** - Calls ABAP REST API to create online repository
23
+ 5. **Set starting folder** - Configures the folder path in repository settings
24
+
25
+ ## Parameters
26
+
27
+ None. The command auto-detects all settings from:
28
+ - Git remote URL
29
+ - `.abapGitAgent` configuration
30
+
31
+ ## Output
32
+
33
+ ### Success
34
+
35
+ ```
36
+ šŸš€ Creating online repository
37
+ URL: https://github.com/org/repo.git
38
+ Package: AUD_TAG
39
+ Folder: /abap/
40
+ Name: abgagt-import
41
+ Branch: main
42
+
43
+
44
+ āœ… Repository created successfully!
45
+ URL: https://github.com/org/repo.git
46
+ Package: AUD_TAG
47
+ Name: abgagt-import
48
+
49
+ Next steps:
50
+ abapgit-agent import
51
+ ```
52
+
53
+ ### Error - Repository Already Exists
54
+
55
+ ```
56
+ āŒ Failed to create repository
57
+ Error: Repository already exists
58
+ ```
59
+
60
+ ### Error - Missing Configuration
61
+
62
+ ```
63
+ āŒ Failed to create repository
64
+ Error: Package not configured
65
+ ```
66
+
67
+ ## Post-Create Steps
68
+
69
+ After creating the repository:
70
+
71
+ ```bash
72
+ # Import objects from ABAP package to git
73
+ abapgit-agent import
74
+
75
+ # Push to git
76
+ git push origin main
77
+
78
+ # Activate in ABAP
79
+ abapgit-agent pull
80
+ ```
81
+
82
+ ## Full Workflow
83
+
84
+ ```
85
+ 1. abapgit-agent init --folder /src/ --package ZMY_PACKAGE
86
+ └─> Creates .abapGitAgent, CLAUDE.md, /src/, updates .gitignore
87
+
88
+ 2. Edit .abapGitAgent (host, user, password, gitUsername, gitPassword)
89
+
90
+ 3. abapgit-agent create
91
+ └─> Creates online repository in ABAP
92
+
93
+ 4. abapgit-agent import
94
+ └─> Stages, commits, and pushes all objects from ZMY_PACKAGE
95
+
96
+ 5. git pull
97
+ └─> Optionally pull to local folder
98
+
99
+ 6. abapgit-agent pull
100
+ └─> Activate objects in ABAP
101
+ ```
102
+
103
+ ## Example
104
+
105
+ ```bash
106
+ # Initialize
107
+ abapgit-agent init --folder /src/ --package ZMYPROJECT
108
+
109
+ # Edit config
110
+ vim .abapGitAgent
111
+
112
+ # Create repo in ABAP
113
+ abapgit-agent create
114
+
115
+ # Import objects to git
116
+ abapgit-agent import
117
+
118
+ # Pull to local folder
119
+ git pull origin main
120
+
121
+ # Activate in ABAP
122
+ abapgit-agent pull
123
+ ```
124
+
125
+ ## Related Commands
126
+
127
+ - [`init`](init-command.md) - Initialize local configuration
128
+ - [`import`](import-command.md) - Import objects from package to git
129
+ - [`pull`](pull-command.md) - Pull and activate objects in ABAP