merge-assist-cli
v1.0.1
Published
AI-powered merge conflict resolver using GitHub Copilot CLI
Maintainers
Readme
🤖 Merge Assist CLI
AI-powered merge conflict resolver using GitHub Copilot CLI. Built for the GitHub Copilot Hackathon.
✨ Features
- 🔍 Smart Conflict Detection - Automatically detect and parse merge conflicts
- 🤖 AI-Powered Analysis - Leverage GitHub Copilot for intelligent conflict resolution
- ⚡ Auto-Resolve - Automatically resolve conflicts with configurable strategies
- 🎯 Interactive Mode - User-friendly interactive CLI for step-by-step resolution
- 📊 Detailed Analytics - Confidence scores and risk assessment for each conflict
- 💾 Safe Operations - Automatic backups before applying changes
- 🎨 Beautiful UI - Colorful output with progress indicators
📋 Prerequisites
- Node.js >= 18.x
- Git repository with merge conflicts
- GitHub CLI with Copilot extension (for AI features)
# Install GitHub CLI and Copilot
gh extension install github/gh-copilot🚀 Installation
Global Installation
npm install -g merge-assist-cliLocal Development
git clone https://github.com/ZarakiLancelot/merge-assist-cli.git
cd merge-assist-cli
npm install
npm run build
npm link📖 Usage
Interactive Mode (Recommended)
Simply run without arguments to enter interactive mode:
merge-assistCommand Line Interface
Detect Conflicts
merge-assist detect [options]
Options:
-p, --path <path> Repository path (default: current directory)
-v, --verbose Verbose outputExample:
merge-assist detectAnalyze Conflicts
merge-assist analyze [options]
Options:
-p, --path <path> Repository path
-f, --file <file> Analyze specific file only
-v, --verbose Verbose outputExample:
merge-assist analyze --file src/app.tsResolve Conflicts Interactively
merge-assist resolve [options]
Options:
-p, --path <path> Repository path
-s, --strategy <strategy> Resolution strategy (current|incoming|both|ai)
--dry-run Preview changes without applying
--no-backup Skip creating backups
-v, --verbose Verbose outputExample:
merge-assist resolve --strategy aiAuto-Resolve Conflicts
merge-assist auto-resolve [options]
Options:
-p, --path <path> Repository path
-s, --strategy <strategy> Resolution strategy (default: ai)
-c, --min-confidence <number> Minimum confidence threshold 0-100 (default: 70)
--skip-low-confidence Skip conflicts below confidence threshold
--dry-run Preview changes without applying
--no-backup Skip creating backups
-v, --verbose Verbose outputExample:
merge-assist auto-resolve --strategy ai --min-confidence 80Show Status
merge-assist status [options]
Options:
-p, --path <path> Repository path
-v, --verbose Verbose outputExample:
merge-assist statusConfiguration
merge-assist config [options]
Options:
--show Show current configuration
--reset Reset to default configuration
--set <key=value> Set a configuration valueExample:
merge-assist config --show
merge-assist config --set defaultStrategy=ai
merge-assist config --reset🎯 Resolution Strategies
1. AI-Assisted (Recommended)
Uses GitHub Copilot to intelligently merge both changes while preserving functionality.
merge-assist resolve --strategy ai2. Keep Current
Keeps changes from your current branch (HEAD).
merge-assist resolve --strategy current3. Keep Incoming
Accepts changes from the incoming branch being merged.
merge-assist resolve --strategy incoming4. Keep Both
Combines both changes with a separator comment.
merge-assist resolve --strategy both🏗️ Architecture
The project follows Clean Architecture and SOLID principles:
src/
├── core/
│ ├── domain/ # Entities and interfaces
│ ├── use-cases/ # Business logic
│ └── services/ # Service implementations
├── infrastructure/ # External integrations (Git, AI, Files)
├── lib/
│ ├── strategies/ # Resolution strategies (Strategy Pattern)
│ └── patterns/ # Design patterns (Factory)
├── cli/
│ ├── commands/ # CLI commands
│ ├── interactive/ # Interactive mode
│ └── ui/ # UI components (Logger, Spinner)
└── utils/ # Utilities (Config, Errors, Validators)Design Patterns Used
- ✅ Strategy Pattern - Resolution strategies
- ✅ Factory Pattern - Strategy creation
- ✅ Dependency Injection - All services
- ✅ Repository Pattern - Git data access
- ✅ Singleton Pattern - Configuration manager
🛠️ Development
Build
npm run buildDevelopment Mode
npm run devLink Locally
npm run linkRun Tests
npm run test:detect
npm run test:analyze
npm run test:resolve
npm run test:status📊 Example Output
Detecting Conflicts
🔍 Detecting Merge Conflicts
─────────────────────────────────────────────────
✓ Repository scan complete
📊 Summary
• Total conflicts: 3
• Affected files: 2
📄 Conflicts by File
⚠ src/utils/helper.ts (1 conflict)
45-52: 8 lines
⚠ src/components/Header.tsx (2 conflicts)
12-18: 7 lines
89-95: 7 lines
ℹ Run 'merge-assist analyze' to get AI-powered suggestionsAuto-Resolving
⚡ Auto-Resolving Merge Conflicts
─────────────────────────────────────────────────
✓ Auto-resolution complete
📊 Resolution Summary
• Total conflicts: 3
• Resolved: 2
• Skipped: 1
• Failed: 0
✅ Successfully Resolved
✓ ai: Conflict 4f3b2a1c
• Confidence: 85%
✓ ai: Conflict 7d8e9f0a
• Confidence: 92%
⏭️ Skipped (Low Confidence)
⚠ src/utils/complex.ts (125-180)
✓ 2 conflicts resolved successfully!🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feat/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feat/amazing-feature) - Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
👨💻 Author
Edwin Einsen Vásquez Velásquez
- GitHub: @ZarakiLancelot
🙏 Acknowledgments
- Built with GitHub Copilot CLI
- Developed for the GitHub Copilot Hackathon
- Inspired by the need for intelligent merge conflict resolution
🐛 Known Issues
- AI resolution requires active GitHub Copilot subscription
- Large conflicts (>500 lines) may timeout with AI strategy
- Interactive mode requires terminal with TTY support
🔮 Future Improvements
- [ ] Machine learning from user preferences
- [ ] Integration with popular Git clients
- [ ] VSCode extension
- [ ] Conflict visualization dashboard
- [ ] Team collaboration features
- [ ] Advanced conflict pattern detection
- [ ] Multi-language syntax awareness
⭐ Star this repo if you find it useful!
