@snapcommit/cli 3.9.8 → 3.9.9

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.
@@ -679,10 +679,64 @@ async function executeGitCommands(commands) {
679
679
  }
680
680
  }
681
681
  catch (error) {
682
+ const errorMsg = error.message?.toLowerCase() || '';
683
+ // Special handling for merge conflicts (check for ANY merge conflict indicators)
684
+ if (cmd.includes('git merge') && (errorMsg.includes('conflict') ||
685
+ errorMsg.includes('both added') ||
686
+ errorMsg.includes('both modified') ||
687
+ errorMsg.includes('unmerged paths') ||
688
+ errorMsg.includes('automatic merge failed'))) {
689
+ console.log(chalk_1.default.yellow('\n⚠️ Merge conflicts detected!\n'));
690
+ // Try AI auto-resolution first
691
+ console.log(chalk_1.default.blue('🤖 Attempting AI conflict resolution...\n'));
692
+ const resolved = await tryAdvancedConflictResolution();
693
+ if (resolved) {
694
+ console.log(chalk_1.default.green('✓ Conflicts resolved automatically!\n'));
695
+ // Complete the merge
696
+ try {
697
+ (0, child_process_1.execSync)('git add -A', { encoding: 'utf-8', stdio: 'pipe' });
698
+ (0, child_process_1.execSync)('git commit --no-edit', { encoding: 'utf-8', stdio: 'pipe' });
699
+ console.log(chalk_1.default.green('✓ Merge completed\n'));
700
+ }
701
+ catch {
702
+ console.log(chalk_1.default.red('\n❌ Failed to complete merge after resolution\n'));
703
+ }
704
+ return;
705
+ }
706
+ // AI couldn't resolve - show manual instructions
707
+ console.log(chalk_1.default.yellow('⚠️ AI could not auto-resolve these conflicts\n'));
708
+ console.log(chalk_1.default.white('Why? These conflicts require human judgment:'));
709
+ console.log(chalk_1.default.gray(' • Business logic decisions (which approach is correct?)'));
710
+ console.log(chalk_1.default.gray(' • Architectural changes (incompatible design choices)'));
711
+ console.log(chalk_1.default.gray(' • Semantic conflicts (both valid, but different intent)\n'));
712
+ console.log(chalk_1.default.white('Conflicted files:'));
713
+ try {
714
+ const conflicts = (0, child_process_1.execSync)('git diff --name-only --diff-filter=U', { encoding: 'utf-8' });
715
+ conflicts.split('\n').filter(f => f.trim()).forEach(file => {
716
+ console.log(chalk_1.default.red(` ✗ ${file}`));
717
+ });
718
+ }
719
+ catch {
720
+ console.log(chalk_1.default.gray(' (could not list files)\n'));
721
+ }
722
+ console.log(chalk_1.default.cyan('\n📖 How to resolve manually:\n'));
723
+ console.log(chalk_1.default.white(' 1. Open each file above in your editor'));
724
+ console.log(chalk_1.default.gray(' Look for conflict markers: ') + chalk_1.default.yellow('<<<<<<< HEAD'));
725
+ console.log(chalk_1.default.gray(' ') + chalk_1.default.yellow('======='));
726
+ console.log(chalk_1.default.gray(' ') + chalk_1.default.yellow('>>>>>>> branch'));
727
+ console.log('');
728
+ console.log(chalk_1.default.white(' 2. Choose which code to keep (or merge both)'));
729
+ console.log(chalk_1.default.gray(' Remove the conflict markers when done'));
730
+ console.log('');
731
+ console.log(chalk_1.default.white(' 3. After fixing, in snap type:'));
732
+ console.log(chalk_1.default.cyan(' complete the merge\n'));
733
+ console.log(chalk_1.default.gray('💡 Tip: Most conflicts are simple! Just pick the better code.\n'));
734
+ return;
735
+ }
682
736
  // Try to auto-fix common errors
683
737
  const fixed = await tryAutoFix(error, cmd);
684
738
  if (!fixed) {
685
- console.log(chalk_1.default.red(`\n❌ ${error.message}\n`));
739
+ console.log(chalk_1.default.red(`\n❌ Command failed: ${error.message}\n`));
686
740
  return;
687
741
  }
688
742
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcommit/cli",
3
- "version": "3.9.8",
3
+ "version": "3.9.9",
4
4
  "description": "Instant AI commits. Beautiful progress tracking. Never write commit messages again.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {