abapgit-agent 1.17.3 → 1.17.5

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/README.md CHANGED
@@ -55,6 +55,7 @@ See [Creating New ABAP Projects](docs/install.md#creating-new-abap-projects) to
55
55
  abapgit-agent init --package ZMY_PACKAGE # Initialize local config
56
56
  abapgit-agent create # Create online repo in ABAP
57
57
  abapgit-agent import # Import objects from ABAP to git
58
+ abapgit-agent import --branch main # Import to specific branch
58
59
  abapgit-agent delete # Delete repo from ABAP
59
60
  ```
60
61
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abapgit-agent",
3
- "version": "1.17.3",
3
+ "version": "1.17.5",
4
4
  "description": "ABAP Git Agent - Pull and activate ABAP code via abapGit from any git repository",
5
5
  "files": [
6
6
  "bin/",
@@ -17,6 +17,31 @@ module.exports = {
17
17
  async execute(args, context) {
18
18
  const { loadConfig, AbapHttp, getTransport, getTransportSettings } = context;
19
19
 
20
+ if (args.includes('--help') || args.includes('-h')) {
21
+ console.log(`
22
+ Usage:
23
+ abapgit-agent customize <table> --set <field=value> [<field=value>...]
24
+ [--transport <TRKORR>] [--no-transport] [--json]
25
+
26
+ Description:
27
+ Write a single row to a SAP customizing table (delivery class C or E).
28
+ The row is identified by the key fields you provide via --set.
29
+
30
+ Parameters:
31
+ <table> Name of the customizing table (e.g. ZTABLE_CONFIG).
32
+ --set <field=value> One or more field=value pairs (space-separated after --set).
33
+ --transport <TRKORR> Record the change in this transport request.
34
+ --no-transport Write without a transport request (local change).
35
+ --json Output result as JSON.
36
+
37
+ Examples:
38
+ abapgit-agent customize ZTABLE_CONFIG --set KEY=APP VALUE=active
39
+ abapgit-agent customize ZTABLE_CONFIG --set KEY=APP VALUE=active --transport DEVK900001
40
+ abapgit-agent customize ZTABLE_CONFIG --set KEY=APP VALUE=active --no-transport
41
+ `);
42
+ return;
43
+ }
44
+
20
45
  const jsonOutput = args.includes('--json');
21
46
  const verbose = args.includes('--verbose');
22
47
  const noTransport = args.includes('--no-transport');
@@ -39,11 +39,14 @@ Prerequisites:
39
39
  - Package must have objects to import
40
40
 
41
41
  Options:
42
+ --branch Branch to push to. Auto-detected from current git branch if omitted.
42
43
  --message Commit message (default: "feat: initial import from ABAP package <package>")
43
44
 
44
45
  Examples:
45
46
  abapgit-agent import
46
47
  abapgit-agent import --message "Initial import from SAP"
48
+ abapgit-agent import --branch main
49
+ abapgit-agent import --branch feature/my-branch --message "Import objects"
47
50
  `);
48
51
  return;
49
52
  }
@@ -87,6 +90,9 @@ Examples:
87
90
  commitMessage = args[messageArgIndex + 1];
88
91
  }
89
92
 
93
+ const branchArgIndex = args.indexOf('--branch');
94
+ const branch = branchArgIndex !== -1 ? args[branchArgIndex + 1] : gitUtils.getBranch();
95
+
90
96
  if (safeguards.requireImportMessage && !commitMessage) {
91
97
  console.error('āŒ Error: import requires a commit message for this project\n');
92
98
  console.error('Please provide one with:');
@@ -99,6 +105,7 @@ Examples:
99
105
 
100
106
  console.log(`\nšŸ“¦ Starting import job`);
101
107
  console.log(` URL: ${repoUrl}`);
108
+ console.log(` Branch: ${branch}`);
102
109
  if (commitMessage) {
103
110
  console.log(` Message: ${commitMessage}`);
104
111
  }
@@ -107,7 +114,8 @@ Examples:
107
114
  const csrfToken = await http.fetchCsrfToken();
108
115
 
109
116
  const data = {
110
- url: repoUrl
117
+ url: repoUrl,
118
+ branch
111
119
  };
112
120
 
113
121
  if (commitMessage) {
@@ -525,11 +525,30 @@ Examples:
525
525
  // 3. Amend last commit
526
526
  execSync('git commit --amend --no-edit', { cwd: process.cwd() });
527
527
 
528
- // 4. Push with force-with-lease; if no upstream, set it automatically
528
+ // 4. Push with force-with-lease; fetch first so tracking ref is current
529
+ // (the remote may have been force-pushed by another process between our last
530
+ // fetch and this push — a fetch makes --force-with-lease reliable)
529
531
  let pushed = false;
530
532
  try {
531
- execSync('git push --force-with-lease', { cwd: process.cwd(), stdio: 'pipe' });
532
- pushed = true;
533
+ try { execSync('git fetch origin', { cwd: process.cwd(), stdio: 'pipe' }); } catch (_) { /* no remote is fine */ }
534
+ // Retry the push up to 3 times on transient server errors (e.g. GitHub Enterprise 500)
535
+ let pushErr;
536
+ for (let attempt = 1; attempt <= 3; attempt++) {
537
+ try {
538
+ execSync('git push --force-with-lease', { cwd: process.cwd(), stdio: 'pipe' });
539
+ pushed = true;
540
+ break;
541
+ } catch (err) {
542
+ pushErr = err;
543
+ const msg = (err.stderr || err.stdout || err.message || '').toString();
544
+ const transient = /internal server error|remote rejected|\b5\d\d\b|connection reset|timed? ?out/i.test(msg);
545
+ if (attempt < 3 && transient) {
546
+ execSync('sleep 2', { stdio: 'pipe' });
547
+ continue;
548
+ }
549
+ throw err;
550
+ }
551
+ }
533
552
  } catch (pushErr) {
534
553
  const msg = (pushErr.stderr || pushErr.stdout || pushErr.message || '').toString();
535
554
  if (msg.includes('no upstream branch') || msg.includes('has no upstream')) {
@@ -109,7 +109,7 @@ Examples:
109
109
  if (flags.version && !flags.abapOnly) {
110
110
  const versionExists = await this.validateVersionExists(flags.version);
111
111
  if (!versionExists) {
112
- console.error(`āŒ Error: Version ${flags.version} not found in npm registry`);
112
+ console.error(`Error: Version ${flags.version} not found in npm registry`);
113
113
  console.error(' Please check available versions at: https://www.npmjs.com/package/abapgit-agent?activeTab=versions');
114
114
  process.exit(1);
115
115
  }