# git-wrapped

[![npm version](https://badge.fury.io/js/git-wrapped.svg)](https://www.npmjs.com/package/git-wrapped)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js Version](https://img.shields.io/node/v/git-wrapped.svg)](https://nodejs.org)

Generate beautiful GitHub Wrapped stats for your team's git repository. Celebrate your team's achievements with a stunning cyberpunk visualization.

## Features

- **Team Stats** - Comprehensive team performance metrics with beautiful visualizations
- **Activity Insights** - Discover your team's most productive months and days
- **Pull Request Analytics** - Track team-wide PR statistics (if `gh` CLI is available)
- **Privacy-Focused** - All data stays local, nothing is sent to external servers

## Installation

```bash
npx git-wrapped /path/to/your/repo
```

Or install globally:

```bash
npm install -g git-wrapped
git-wrapped /path/to/your/repo
```

## Usage

### Basic Usage

```bash
# Analyze last 12 months (default)
npx git-wrapped /path/to/repo

# Opens browser automatically to http://localhost:3000
```

### Custom Date Range

```bash
# Analyze a specific year
npx git-wrapped /path/to/repo --start 2024-01-01 --end 2024-12-31

# Analyze last 6 months
npx git-wrapped /path/to/repo --start 2024-06-01
```

### Custom Port

```bash
# Use a different port
npx git-wrapped /path/to/repo --port 8080
npx git-wrapped /path/to/repo -p 8080
```

### All Options

```bash
npx git-wrapped <repo-path> [options]

Options:
  --start, -s    Start date (YYYY-MM-DD). Default: 12 months ago
  --end, -e      End date (YYYY-MM-DD). Default: today
  --port, -p     Server port. Default: 3000
  --help, -h     Show help
```

## What Gets Analyzed

### Team Stats
- Total commits across all team members
- Lines added and removed by the team
- Busiest months and days
- Activity patterns by day of week
- Pull request statistics (if `gh` CLI is available)
- Net code change metrics

## Requirements

- Node.js 18.0.0 or higher
- Git (for analyzing repositories)
- Optional: GitHub CLI (`gh`) for PR statistics

## How It Works

1. Runs git commands to collect repository statistics
2. Calculates team-wide metrics
3. Starts a local web server
4. Opens your browser to a beautiful visualization

All data stays local - nothing is sent to external servers.

## Screenshots

The visualization features a cyberpunk neon theme with:
- Animated grid backgrounds
- Glowing neon colors
- Interactive cards and transitions
- Responsive design for all screen sizes

## Development

```bash
# Clone the repo
git clone <repo-url>
cd git-wrapped

# Install dependencies
npm install

# Build everything
npm run build:all

# Test locally
node bin/git-wrapped.js /path/to/any/git/repo
```

### Project Structure

```
git-wrapped/
├── bin/                  # CLI entry point
├── src/                  # Backend TypeScript
│   ├── cli.ts           # CLI argument parser
│   ├── server.ts        # HTTP server
│   ├── index.ts         # Main entry
│   ├── types.ts         # Type definitions
│   ├── collectors/      # Data collection modules
│   └── utils/           # Utilities
├── ui/                   # Frontend
│   ├── src/             # TypeScript source
│   ├── *.html           # HTML pages
│   └── styles.css       # Cyberpunk theme
├── build-ui.js          # UI build script
└── package.json
```

## License

MIT
