branch-party 0.1.1

A CLI tool for creating and maintaining party branches - automated git branch merging for development workflows
# 🎉 Branch Party

A CLI tool for creating and maintaining "party branches" - automated git branch merging for development workflows.

[![License](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg)](#license)
[![Rust](https://img.shields.io/badge/rust-1.75%2B-orange.svg)](https://www.rust-lang.org/)

## What is Branch Party?

Branch Party automates the creation and maintenance of "party branches" - combined branches that merge multiple feature branches together for testing, staging, or integration purposes.

**Key Features:**
- 🚀 **Automated Party Branch Creation**: Combine multiple feature branches into party branches
- 🔄 **Auto-Update on Commits**: Party branches automatically update when member branches change  
- 🛡️ **Protection**: Prevents direct commits to party branches
- 📋 **Flexible Configuration**: YAML-based configuration with support for complex merge strategies
- 🎯 **Interactive Mode**: Select branches interactively or configure via CLI
- 🔍 **Conflict Resolution**: Configurable conflict resolution strategies per file or globally

## Status

✅ **Fully Implemented**
- Complete CLI with all core commands
- Git hooks for automatic updates (pre-commit, post-commit, post-merge)
- Party resolution and merge planning with cycle detection
- Advanced merge engine with conflict policies
- Configuration system with full precedence
- Interactive branch selection
- Auto-update functionality
- Protection against direct party branch commits

## Installation

### Via Cargo (Recommended)
```bash
cargo install branch-party
```

### From Source
```bash
git clone https://github.com/yourusername/branch-party
cd branch-party
cargo install --path .
```

### Pre-built Binaries
Download from the [releases page](https://github.com/yourusername/branch-party/releases)

## Quick Start

### 1. Initialize in your repository
```bash
cd your-project
branch-party init --with-sample
```

### 2. Configure your parties
```yaml
# .git/branch-party/config.yaml
parties:
  qa:
    members:
    - feature/user-auth
    - feature/payments  
    merge_order: listed
    conflict_policy:
      default: manual

auto_update:
  enabled: true
  parties: all
```

### 3. Create party branches
```bash
branch-party run --party qa
```

### 4. Enable automatic updates
```bash
branch-party init --with-hooks
```

Now when you commit to `feature/user-auth`, the `qa` party branch automatically updates!

## Commands

- **`init`** - Initialize branch-party in current repository
- **`run --party <name>`** - Create/update a party branch
- **`list`** - Show all configured parties
- **`plan --party <name>`** - Preview merge plan without executing
- **`validate`** - Validate configuration
- **`select`** - Interactive branch selection
- **`completions <shell>`** - Generate shell completions

## Configuration

The tool creates `.branch-party/config.yaml` with this structure:

```yaml
base_branch: main
parties:
  qa:
    members:
      - feature/a
      - feature/b  
      - "@payments"  # Reference to another party
    merge_order: listed  # listed | newest_first | oldest_first
    conflict_policy:
      default: ours  # ours | theirs | union | manual
      overrides:
        - { path: "Gemfile.lock", mode: "ours" }
        - { path: "yarn.lock", mode: "theirs" }
```

## Architecture

- **`branch_party_core`** - Core library with business logic
- **`branch-party`** - CLI binary that uses the core library

Key modules:
- `config` - Configuration structures and parsing
- `config_loader` - Multi-source configuration loading with precedence
- `git` - Git repository operations via git2
- `model` - Data models for branches, merge plans, and repo state  
- `report` - Run report generation and serialization
- `error` - Structured error types with context

## Development

```bash
# Run tests
cargo test

# Check code
cargo check

# Format and lint
cargo fmt
cargo clippy

# Run with debug logging
RUST_LOG=debug cargo run --bin branch-party -- list

# Generate completions
cargo run --bin branch-party -- completions bash > branch-party.bash
```

## License

MIT OR Apache-2.0