Skip to content

Repository files navigation

Git Branch Cleanup Tool

Dual-version application for streamlining cleanup of merged branches in git repositories

A professional monorepo featuring a CLI tool and web interface for managing git branch cleanup with an elegant, minimalist design.


🎯 Features

Core Functionality

  • βœ… Analyze merged branches in any git repository
  • βœ… Interactive branch selection (multi-select with checkboxes)
  • βœ… Pattern-based filtering (regex support)
  • βœ… Date-based filtering (branches older than X)
  • βœ… Dry-run mode (preview without deleting)
  • βœ… Batch branch deletion with confirmation
  • βœ… Comprehensive error handling

CLI Application

  • πŸ“Ÿ Interactive terminal prompts (inquirer)
  • 🎨 Color-coded output (chalk)
  • πŸ“Š Formatted branch tables (cli-table3)
  • βš™οΈ Command-line options (pattern, exclude, dry-run)
  • πŸš€ Fast and lightweight

Web Application

  • 🎨 Refined minimalist UI (shadcn-vue + Tailwind CSS)
  • πŸ”΅ Professional blue theme with Poppins & Open Sans fonts
  • πŸ“± Responsive design (mobile-first)
  • β™Ώ WCAG AA accessibility compliant
  • ⚑ Fast Vite build (270KB JS, 28KB CSS gzipped)
  • 🎭 Smooth animations (200ms transitions)

πŸ—οΈ Architecture

branch-cleanup-monorepo/
β”œβ”€β”€ packages/
β”‚   └── core/              # Shared library (TypeScript)
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ git-operations.ts    # Git command wrappers
β”‚       β”‚   β”œβ”€β”€ branch-analyzer.ts   # Merge detection logic
β”‚       β”‚   β”œβ”€β”€ branch-manager.ts    # Deletion operations
β”‚       β”‚   β”œβ”€β”€ validators.ts        # Input validation
β”‚       β”‚   └── types.ts             # TypeScript interfaces
β”‚       └── tests/                   # 79 tests, 100% passing
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ cli/               # CLI application (Node.js)
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts           # Entry point
β”‚   β”‚   β”‚   β”œβ”€β”€ cli.ts             # Main flow
β”‚   β”‚   β”‚   β”œβ”€β”€ prompts.ts         # Inquirer prompts
β”‚   β”‚   β”‚   └── display.ts         # Terminal formatting
β”‚   β”‚   └── dist/                  # Built executable
β”‚   β”œβ”€β”€ api/               # Backend API (Express)
β”‚   β”‚   └── src/
β”‚   β”‚       β”œβ”€β”€ index.ts           # Server setup
β”‚   β”‚       β”œβ”€β”€ routes.ts          # API endpoints
β”‚   β”‚       β”œβ”€β”€ middleware.ts      # CORS, validation
β”‚   β”‚       └── schemas.ts         # Zod schemas
β”‚   └── web/               # Web frontend (Vue 3 + Vite)
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ components/        # Vue components
β”‚       β”‚   β”‚   β”œβ”€β”€ ui/           # shadcn-vue components
β”‚       β”‚   β”‚   β”œβ”€β”€ repository-form.vue
β”‚       β”‚   β”‚   β”œβ”€β”€ branch-table.vue
β”‚       β”‚   β”‚   └── delete-dialog.vue
β”‚       β”‚   β”œβ”€β”€ composables/       # Vue composables
β”‚       β”‚   β”œβ”€β”€ views/             # Pages
β”‚       β”‚   └── types/             # TypeScript types
β”‚       └── dist/                  # Production build
└── pnpm-workspace.yaml

πŸš€ Quick Start

Prerequisites

  • Node.js 22+
  • pnpm 9+
  • Git repository to clean up

Installation

# Clone repository
git clone <repo-url>
cd branch-cleanup

# Install dependencies
pnpm install

# Build all packages
pnpm build

CLI Usage

# Run CLI interactively
pnpm dev:cli

# Or use built binary
cd apps/cli
./dist/index.js

# With options
./dist/index.js --pattern "feature/*" --dry-run

CLI Options:

  • --pattern <regex> - Filter branches by pattern
  • --exclude <regex> - Exclude branches matching pattern
  • --older-than <date> - Only branches older than date
  • --dry-run - Preview without deleting
  • --help - Show help
  • --version - Show version

Web Usage

# Start backend API
pnpm dev:api
# API runs at http://localhost:3000

# Start web frontend
pnpm dev:web
# Web app runs at http://localhost:5173

Web Interface:

  1. Enter repository path
  2. Select target branch
  3. (Optional) Apply filters
  4. Analyze merged branches
  5. Select branches to delete
  6. Confirm deletion (or dry-run preview)

πŸ§ͺ Testing

# Run all tests
pnpm test

# Run specific package tests
pnpm test:core    # Core library (79 tests)
pnpm test:cli     # CLI tests
pnpm test:api     # API tests

# Type checking
pnpm typecheck

# Coverage report
pnpm test:core --coverage

Test Results:

  • βœ… 79/79 tests passing (100%)
  • βœ… >70% code coverage
  • βœ… Real git repositories (no mocks)
  • βœ… All type checks passing

πŸ“¦ Monorepo Commands

# Development
pnpm dev:cli      # Run CLI in watch mode
pnpm dev:api      # Run API in watch mode
pnpm dev:web      # Run web app in dev mode

# Building
pnpm build        # Build all packages
pnpm build:core   # Build core library only
pnpm build:cli    # Build CLI only
pnpm build:api    # Build API only
pnpm build:web    # Build web app only

# Testing
pnpm test         # Run all tests
pnpm test:core    # Test core library
pnpm typecheck    # Type check all packages

# Cleaning
pnpm clean        # Remove all dist/ and node_modules/

🎨 Design System

Colors

  • Primary: #2563EB (Trust Blue)
  • Background: #F8FAFC (Light Slate)
  • Text: #1E293B (Dark Slate)
  • Border: #E2E8F0 (Light Slate Border)
  • Destructive: #DC2626 (Red)

Typography

  • Headings: Poppins (400, 500, 600, 700)
  • Body: Open Sans (300, 400, 500, 600, 700)
  • Hierarchy: text-sm β†’ text-base β†’ text-lg β†’ text-2xl β†’ text-4xl

Components

  • shadcn-vue components (Card, Table, Button, Input, Select, etc.)
  • Lucide Vue icons
  • 200ms transitions
  • Subtle shadows
  • WCAG AA compliant

🏒 Tech Stack

Shared

  • Language: TypeScript 5.7
  • Package Manager: pnpm 9.15
  • Monorepo: pnpm workspaces
  • Node: 22+

Core Library

  • simple-git 3.27 (Git operations)
  • Zod 3.23 (Runtime validation)
  • Vitest 2.1 (Testing)

CLI

  • @inquirer/prompts 7.2 (Interactive prompts)
  • Commander 12.1 (CLI framework)
  • chalk 5.4 (Terminal colors)
  • cli-table3 0.6 (Tables)

API

  • Express 4.21 (REST API)
  • CORS 2.8 (Cross-origin)
  • Zod 3.23 (Validation)

Web

  • Vue 3.5 (Framework)
  • Vite 6.0 (Build tool)
  • shadcn-vue (Component library)
  • Tailwind CSS 3.4 (Styling)
  • Axios 1.7 (HTTP client)
  • Lucide Vue 0.469 (Icons)

πŸ“– Documentation

  • Plan: plans/260106-2239-git-branch-cleanup-dual-app/plan.md
  • Design Guidelines: docs/design-guidelines.md
  • Test Reports: plans/reports/tester-*.md
  • Implementation Reports: plans/reports/fullstack-developer-*.md

🀝 Contributing

  1. Follow YAGNI, KISS, DRY principles
  2. Keep files under 200 lines
  3. Use kebab-case for file names
  4. Add JSDoc comments to public APIs
  5. Write tests for new features
  6. Ensure type safety (no any)
  7. Run pnpm typecheck before committing

πŸ“ License

MIT


πŸ™ Credits

Built with:

Designed with refined minimalism principles.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages