Skip to content

bramato/git-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Git Copilot

Transform your Git workflow with AI-powered analysis, documentation, and code review

npm version Downloads License: MIT Node.js CI Node.js Version

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.

✨ Why Git Copilot?

  • πŸ€– 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

🎯 Core Features

πŸ” Smart Branch Analysis

  • 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

πŸ“š Automated Documentation

  • 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

πŸ›‘οΈ Advanced Code Review

  • 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

πŸ“¦ Installation

Choose your preferred installation method:

🌟 Global Installation (Recommended)

Install once, use everywhere:

npm install -g @bramatom/git-copilot

πŸ“ Local Project Installation

For project-specific usage:

npm install @bramatom/git-copilot --save-dev

⚑ One-time Usage with npx

Try without installing:

npx @bramatom/git-copilot [command]

πŸ“‹ Requirements

  • Node.js >= 16.0.0
  • Git installed and configured
  • OpenRouter API key (for AI features) - Get yours at OpenRouter.ai

πŸš€ Quick Start

Get up and running in 60 seconds:

1️⃣ Set up OpenRouter API Key

export OPENROUTER_API_KEY="your-api-key-here"

πŸ’‘ Pro tip: Add this to your .bashrc, .zshrc, or .env file for persistent access

2️⃣ Navigate to Your Git Repository

cd your-awesome-project

3️⃣ Run Your First Analysis

git-copilot analyze-branch

4️⃣ See the Magic! ✨

πŸ” 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

πŸŽͺ Use Cases & Examples

πŸ‘¨β€πŸ’» For Individual Developers

# 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

πŸ‘₯ For Development Teams

# 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

🏒 For Enterprise Projects

# 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

πŸ“– Commands Reference

πŸ” analyze-branch - Smart Git Analysis

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

πŸ“š document - AI Documentation Generator

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

πŸ›‘οΈ review - Comprehensive Code Review

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)

πŸ€– Specialized AI Agents

Git Copilot employs three specialized AI agents, each expert in their domain, powered by OpenRouter:

🎯 PR/Git Expert Agent

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

πŸ“š Documentation Expert Agent

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

πŸ” Code Review Expert Agent

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

βš™οΈ Configuration

🌐 Environment Variables

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

πŸ“ Project-Specific Configuration

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.

πŸ“„ Generated Files

Git Copilot creates intelligent, actionable output files:

πŸ› οΈ fix.md - Code Review Report

# 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

πŸ“š Documentation Files

  • 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

🎯 Real Examples

πŸ“Š 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

πŸ› οΈ Development & Contributing

πŸ—οΈ Project Architecture

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

πŸš€ Local Development Setup

1️⃣ Clone & Install

git clone https://github.com/bramato/git-copilot.git
cd git-copilot
npm install

2️⃣ Development Mode

# Link for global testing
npm link

# Test your changes
git-copilot --version

3️⃣ Code Quality

# Run tests
npm test

# Lint code  
npm run lint
npm run lint:fix

# Type checking (if TypeScript)
npm run type-check

πŸ§ͺ Testing Framework

# Unit tests
npm run test:unit

# Integration tests  
npm run test:integration

# Coverage report
npm run test:coverage

🀝 Contributing Guidelines

We welcome contributions! Here's how to get involved:

🌟 Ways to Contribute

  • πŸ› 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

πŸš€ Contribution Workflow

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch:
    git checkout -b feature/amazing-new-feature
  3. ✨ Develop your changes:
    • Add comprehensive tests
    • Follow existing code style
    • Update documentation if needed
  4. πŸ§ͺ Test everything:
    npm test
    npm run lint
  5. πŸ“ Commit with clear messages:
    git commit -m "✨ Add amazing new feature
    
    - Implement feature X with Y capability
    - Add comprehensive tests
    - Update documentation"
  6. πŸš€ Push and create a Pull Request

πŸ“‹ Development Standards

  • βœ… 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

πŸ“¦ Publishing & Releases

🏷️ Semantic Versioning

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

πŸš€ NPM Publishing Process

# 1. Ensure everything is tested
npm test

# 2. Update version
npm version patch  # or minor/major

# 3. Publish to NPM
npm publish

πŸ€– CI/CD Pipeline

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

πŸ’¬ Support & Community

πŸ†˜ Get Help

πŸ“Š Project Stats

GitHub stars GitHub forks GitHub watchers

πŸ† Recognition & Thanks

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

πŸ”— Related Projects

πŸ“„ License

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

πŸš€ Ready to Transform Your Git Workflow?

npm install -g @bramatom/git-copilot

Made with πŸ’œ by bramato and the open source community

Git Copilot - Where AI meets Git mastery ✨

About

AI-powered Git analysis and documentation tool using OpenRouter agents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •