resulgit 1.0.14 → 1.0.15

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 (2) hide show
  1. package/package.json +1 -1
  2. package/resulgit.js +34 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resulgit",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "A powerful CLI tool for version control system operations - clone, commit, push, pull, merge, branch management, and more",
5
5
  "main": "resulgit.js",
6
6
  "bin": {
package/resulgit.js CHANGED
@@ -1430,14 +1430,44 @@ async function cmdPush(opts) {
1430
1430
  }
1431
1431
  if (conflicts.length > 0) {
1432
1432
  spinnerFail(spinner, 'Push blocked by conflicts')
1433
+
1434
+ // Write conflict markers to local files
1435
+ for (const c of conflicts) {
1436
+ const localContent = local[c.path]?.content || ''
1437
+ const remoteContent = remote.files[c.path] || ''
1438
+
1439
+ // Create conflict-marked content
1440
+ const conflictContent = [
1441
+ '<<<<<<< LOCAL (your changes)',
1442
+ localContent,
1443
+ '=======',
1444
+ remoteContent,
1445
+ '>>>>>>> REMOTE (server changes)'
1446
+ ].join('\n')
1447
+
1448
+ // Write to local file
1449
+ const conflictPath = path.join(dir, c.path)
1450
+ await fs.promises.mkdir(path.dirname(conflictPath), { recursive: true })
1451
+ await fs.promises.writeFile(conflictPath, conflictContent, 'utf8')
1452
+ }
1453
+
1433
1454
  if (opts.json === 'true') {
1434
- print({ conflicts }, true)
1455
+ print({ conflicts, message: 'Conflict markers written to files. Resolve them and try again.' }, true)
1435
1456
  } else {
1436
- process.stderr.write(color('Error: Cannot push with conflicts\\n', 'red'))
1437
- process.stderr.write(color('Conflicts detected:\\n', 'yellow'))
1457
+ process.stderr.write(color('\nConflicts detected! The following files have been updated with conflict markers:\n', 'red'))
1438
1458
  for (const c of conflicts) {
1439
- process.stderr.write(color(` ${c.path}:${c.line}\\n`, 'red'))
1459
+ process.stderr.write(color(` ${c.path}\n`, 'yellow'))
1440
1460
  }
1461
+ process.stderr.write(color('\nTo resolve:\n', 'cyan'))
1462
+ process.stderr.write(color(' 1. Open the files above and look for conflict markers:\n', 'dim'))
1463
+ process.stderr.write(color(' <<<<<<< LOCAL (your changes)\n', 'dim'))
1464
+ process.stderr.write(color(' ... your version ...\n', 'dim'))
1465
+ process.stderr.write(color(' =======\n', 'dim'))
1466
+ process.stderr.write(color(' ... server version ...\n', 'dim'))
1467
+ process.stderr.write(color(' >>>>>>> REMOTE (server changes)\n', 'dim'))
1468
+ process.stderr.write(color(' 2. Edit the files to keep the changes you want\n', 'dim'))
1469
+ process.stderr.write(color(' 3. Remove the conflict markers\n', 'dim'))
1470
+ process.stderr.write(color(' 4. Run: resulgit add . && resulgit commit -m "Resolved conflicts" && resulgit push\n\n', 'dim'))
1441
1471
  }
1442
1472
  return
1443
1473
  }