abapgit-agent 1.17.4 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abapgit-agent",
3
- "version": "1.17.4",
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/",
@@ -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
  }