JSPM

@bramatom/git-copilot

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q33607F
  • License MIT

AI-powered Git analysis and documentation tool using OpenRouter agents

Package Exports

  • @bramatom/git-copilot
  • @bramatom/git-copilot/bin/git-copilot.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@bramatom/git-copilot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

๐Ÿš€ 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:

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

๐Ÿ“„ 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 โœจ