Transform your Git workflow with AI-powered analysis, documentation, and code review
Git Copilot revolutionizes your development workflow by combining the power of AI with Git operations. This intelligent CLI tool provides comprehensive code analysis, automated documentation generation, and thorough code reviews - all powered by cutting-edge AI agents through OpenRouter integration.
- π€ AI-Powered Intelligence: Leverages advanced AI models for deep code understanding
- β‘ Lightning Fast: Get instant insights without leaving your terminal
- π― Specialized Agents: Three expert AI agents for different development needs
- π Actionable Reports: Detailed fix.md files with prioritized recommendations
- π§ Zero Configuration: Works out of the box with any Git repository
- π OpenRouter Integration: Access to multiple AI models and providers
- Comprehensive Change Detection: Analyzes staged, unstaged, and untracked files
- Commit Quality Assessment: Reviews commit messages and history patterns
- Intelligent Recommendations: AI-powered suggestions for improving your workflow
- Statistics & Insights: Detailed diff stats and change summaries
- README Generation: Creates professional project documentation automatically
- API Documentation: Extracts and documents your code's API surface
- Changelog Management: Maintains version history with semantic understanding
- Style-Aware Writing: Follows your existing documentation patterns
- Security Analysis: Detects hardcoded secrets, eval usage, and vulnerabilities
- Performance Optimization: Identifies sync operations, nested loops, and bottlenecks
- Code Quality Checks: Finds magic numbers, long functions, and complexity issues
- Best Practice Enforcement: Suggests improvements based on industry standards
- Prioritized Fix Reports: Generates actionable fix.md files with severity ratings
Choose your preferred installation method:
Install once, use everywhere:
npm install -g @bramatom/git-copilot
For project-specific usage:
npm install @bramatom/git-copilot --save-dev
Try without installing:
npx @bramatom/git-copilot [command]
- Node.js >= 16.0.0
- Git installed and configured
- OpenRouter API key (for AI features) - Get yours at OpenRouter.ai
Get up and running in 60 seconds:
export OPENROUTER_API_KEY="your-api-key-here"
π‘ Pro tip: Add this to your .bashrc
, .zshrc
, or .env
file for persistent access
cd your-awesome-project
git-copilot analyze-branch
π BRANCH ANALYSIS REPORT
========================
π Current Branch: feature/user-auth
π Statistics:
3 files changed, 127 insertions(+), 23 deletions(-)
π Changes Summary:
β’ Staged: 2 files
β’ Unstaged: 1 files
β’ Untracked: 0 files
π‘ Recommendations:
β’ β
No pending changes detected
β’ π 2 files staged for commit
β’ π¬ Consider more descriptive commit messages
# Before starting work
git-copilot analyze-branch # Understand current state
# During development
git-copilot review # Continuous quality checks
# Before committing
git-copilot analyze-branch # Final review
# For documentation
git-copilot document # Auto-generate docs
# Code review process
git-copilot review > team-review.md
# Documentation standards
git-copilot document --force # Standardized docs
# PR preparation
git-copilot analyze-branch # Pre-PR analysis
# Security audits
git-copilot review # Identify security issues
# Compliance reporting
git-copilot review --path src/ # Focused analysis
# Documentation maintenance
git-copilot document # Keep docs current
Provides comprehensive analysis of your Git branch with AI-powered insights.
git-copilot analyze-branch
# Also works as default command:
git-copilot
analyze-branch # Direct global command
What it analyzes:
- β Staged, unstaged, and untracked files
- π Commit history and message quality
- π Diff statistics and change patterns
- π‘ Workflow improvement suggestions
Example Output:
π Analyzing branch changes...
β
Analysis complete!
π Current Branch: feature/auth-system
π Changes Summary: 5 files staged, 2 unstaged
π‘ Recommendations: Consider more descriptive commit messages
Creates comprehensive project documentation tailored to your codebase.
git-copilot document
git-copilot doc # Short alias
Features:
- π Analyzes existing documentation style
- ποΈ Generates README.md, API.md, and CHANGELOG.md
- π Reads project structure and package.json
- π¨ Maintains consistent formatting
Example:
git-copilot document
# Creates: README.md, API.md, CHANGELOG.md
Performs deep code analysis and generates detailed improvement reports.
git-copilot review
Analysis Categories:
- π΄ Security: Hardcoded secrets, eval usage, vulnerabilities
- π‘ Performance: Sync operations, nested loops, bottlenecks
- π’ Quality: Magic numbers, long functions, complexity
- βΉοΈ Best Practices: TODOs, debug statements, conventions
Output:
- π fix.md: Detailed report with prioritized issues
- π Statistics: Issue counts by severity and category
- π‘ Recommendations: Actionable improvement suggestions
Example Report:
# Code Review Report
Total issues found: 12
### Issues by Severity
- π΄ High: 2 (Security vulnerabilities)
- π‘ Medium: 4 (Performance issues)
- π’ Low: 6 (Code quality)
Git Copilot employs three specialized AI agents, each expert in their domain, powered by OpenRouter:
The Git Whisperer - Understands your repository like a senior developer
// Capabilities:
β’ Branch difference analysis with context awareness
β’ Commit quality assessment and pattern recognition
β’ Pull request optimization suggestions
β’ Breaking change detection and impact analysis
β’ Workflow improvement recommendations
The Technical Writer - Transforms code into clear, professional docs
// Capabilities:
β’ Intelligent README generation based on project structure
β’ API documentation extraction from code analysis
β’ Changelog creation with semantic versioning awareness
β’ Style consistency maintenance across all documentation
β’ Integration with existing KB.md and documentation rules
The Quality Guardian - Your personal code quality mentor
// Capabilities:
β’ Multi-layered security vulnerability detection
β’ Performance bottleneck identification and optimization
β’ Code complexity analysis with maintainability scoring
β’ Best practice enforcement with industry standards
β’ Prioritized fix reports with actionable recommendations
Powered by: Claude 3.5 Sonnet, GPT-4, and other cutting-edge AI models via OpenRouter
Variable | Description | Required | Default |
---|---|---|---|
OPENROUTER_API_KEY |
Your OpenRouter API key | β Yes | - |
GIT_COPILOT_MODEL |
AI model to use | β No | claude-3.5-sonnet |
# Add to your shell profile (.bashrc, .zshrc, etc.)
export OPENROUTER_API_KEY="your-api-key-here"
export GIT_COPILOT_MODEL="gpt-4" # Optional: customize AI model
Git Copilot intelligently adapts to your project by reading existing files:
File | Purpose | Impact |
---|---|---|
README.md |
Documentation style reference | π Maintains writing consistency |
KB.md |
Knowledge base and style guidelines | π¨ Follows your team's conventions |
.github/CONTRIBUTING.md |
Contribution guidelines | π₯ Aligns with project standards |
docs/STYLE_GUIDE.md |
Code style preferences | π― Customizes review criteria |
package.json |
Project metadata | π¦ Understands dependencies and scripts |
Smart Defaults: No configuration files? No problem! Git Copilot works great out of the box.
Git Copilot creates intelligent, actionable output files:
# Code Review Report
Generated: 2024-01-15
## Summary
Total issues found: 23
- π΄ High: 3 (Security vulnerabilities)
- π‘ Medium: 8 (Performance issues)
- π’ Low: 12 (Code quality improvements)
## High Priority Fixes
1. **auth.js:42** - Hardcoded API key detected
2. **db.js:15** - SQL injection vulnerability
3. **utils.js:89** - Use of eval() is dangerous
- README.md - Professional project documentation with usage examples
- API.md - Comprehensive API reference with endpoints and examples
- CHANGELOG.md - Semantic version history with detailed change descriptions
π Sample Branch Analysis Output
π BRANCH ANALYSIS REPORT
========================
π Current Branch: feature/user-authentication
π Statistics: 8 files changed, 234 insertions(+), 67 deletions(-)
π Changes Summary:
β’ Staged: 5 files (auth.js, user.model.js, login.vue, etc.)
β’ Unstaged: 2 files (config.js, .env.example)
β’ Untracked: 1 file (migration_001.sql)
π― Recent Commits (last 10):
β’ a1b2c3d Add JWT authentication middleware
β’ e4f5g6h Update user model with password hashing
β’ i7j8k9l Fix login form validation
π‘ Recommendations:
β’ β
Good commit message structure
β’ π 5 files ready for commit
β’ β οΈ Consider staging config.js changes
β’ π New migration file detected - review before commit
β’ π Ensure sensitive data is properly excluded from git
git-copilot/
βββ π bin/ # CLI executables & entry points
β βββ git-copilot.js # Main CLI interface
βββ π src/ # Core source code
β βββ commands/ # Command implementations
β β βββ analyze-branch.js # Git analysis logic
β β βββ documentation.js # Doc generation
β β βββ review.js # Code review engine
β βββ utils/ # Shared utilities
β β βββ git-checker.js # Git validation
β βββ types/ # TypeScript definitions
βββ π agents/ # AI agent implementations
β βββ pr-git-expert.js # Git analysis specialist
β βββ documentation-expert.js # Documentation creator
β βββ code-review-expert.js # Code quality auditor
βββ π tests/ # Test suites
βββ π docs/ # Project documentation
βββ π package.json # Project metadata
git clone https://github.com/bramato/git-copilot.git
cd git-copilot
npm install
# Link for global testing
npm link
# Test your changes
git-copilot --version
# Run tests
npm test
# Lint code
npm run lint
npm run lint:fix
# Type checking (if TypeScript)
npm run type-check
# Unit tests
npm run test:unit
# Integration tests
npm run test:integration
# Coverage report
npm run test:coverage
We welcome contributions! Here's how to get involved:
- π Bug Reports: Found an issue? Create an issue
- π‘ Feature Requests: Have an idea? We'd love to hear it!
- π§ Code Contributions: Fix bugs or add features
- π Documentation: Improve docs and examples
- π§ͺ Testing: Add test cases and improve coverage
- π΄ Fork the repository
- πΏ Create a feature branch:
git checkout -b feature/amazing-new-feature
- β¨ Develop your changes:
- Add comprehensive tests
- Follow existing code style
- Update documentation if needed
- π§ͺ Test everything:
npm test npm run lint
- π Commit with clear messages:
git commit -m "β¨ Add amazing new feature - Implement feature X with Y capability - Add comprehensive tests - Update documentation"
- π Push and create a Pull Request
- β Code Coverage: Maintain > 80% test coverage
- π¨ Code Style: Follow ESLint configuration
- π Documentation: Update README for new features
- π§ͺ Testing: Add tests for all new functionality
- π Security: No hardcoded secrets or vulnerabilities
We follow SemVer for version management:
# Patch release (bug fixes)
npm version patch
# Minor release (new features)
npm version minor
# Major release (breaking changes)
npm version major
# 1. Ensure everything is tested
npm test
# 2. Update version
npm version patch # or minor/major
# 3. Publish to NPM
npm publish
Our GitHub Actions automatically handle:
- β Automated Testing: Run full test suite on PRs
- π NPM Publishing: Automatic publishing on release tags
- π Code Quality: ESLint and security checks
- π Coverage Reports: Track test coverage trends
- π Documentation: Complete Guide
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
- π€ Questions: Stack Overflow
Special Thanks To:
- π€ OpenRouter - Providing access to cutting-edge AI models
- π§ openrouter-agents - The foundation for our AI integration
- π₯ Open Source Community - For inspiration and collaborative spirit
- π§ AI Research Community - Making advanced language models accessible
- π€ openrouter-agents - AI agent framework
- π Git Flow Tools - Similar workflow tools
- π Documentation Generators - Doc automation tools
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License - Free for commercial and personal use
β
Commercial use β
Modification β
Distribution β
Private use
npm install -g @bramatom/git-copilot
Made with π by bramato and the open source community
Git Copilot - Where AI meets Git mastery β¨