Skip to content

chaspy/workbloom

Repository files navigation

Workbloom

Build Quality Gate Status Coverage Crates.io

A Git worktree management tool written in Rust that automates worktree setup and file copying.

Features

  • 🌲 Easy worktree setup - Create git worktrees with a single command
  • 📦 Automatic file copying - Copies essential files (.env, .envrc, etc.) to new worktrees
  • 🧹 Smart cleanup - Remove merged worktrees automatically or interactively
  • 🎨 Beautiful output - Colored terminal output with progress indicators
  • 💬 Claude Comment Management - Automatically minimize old Claude PR review comments

Installation

From crates.io (Recommended)

cargo install workbloom

From GitHub

cargo install --git https://github.com/chaspy/workbloom.git

From source

git clone https://github.com/chaspy/workbloom.git
cd workbloom
cargo install --path .

Shell Integration (Recommended)

Alias for shorter commands

Add this alias to your .bashrc or .zshrc for shorter commands:

alias wb='workbloom'

With this alias and the built-in short aliases, you can use:

  • wb s feature/my-feature instead of workbloom setup feature/my-feature
  • wb c instead of workbloom cleanup

Auto-change directory after setup

To automatically change to the worktree directory after setup, add this function to your .bashrc or .zshrc:

workbloom-setup() {
    local output=$(workbloom setup "$@")
    echo "$output"
    
    # Extract the worktree path and change to it
    local worktree_path=$(echo "$output" | grep "📍 Worktree location:" | sed 's/.*: //')
    if [ -n "$worktree_path" ] && [ -d "$worktree_path" ]; then
        cd "$worktree_path"
        echo "📂 Changed to worktree directory: $(pwd)"
    fi
}

# Or with the alias:
wb-setup() {
    local output=$(wb s "$@")
    echo "$output"
    
    # Extract the worktree path and change to it
    local worktree_path=$(echo "$output" | grep "📍 Worktree location:" | sed 's/.*: //')
    if [ -n "$worktree_path" ] && [ -d "$worktree_path" ]; then
        cd "$worktree_path"
        echo "📂 Changed to worktree directory: $(pwd)"
    fi
}

# Then use: workbloom-setup feature/my-feature
# Or: wb-setup feature/my-feature

Usage

Setup a new worktree

# Setup and start a new shell in the worktree directory (default)
workbloom setup feature/my-new-feature
# Or using short alias: wb s feature/my-new-feature

# Setup without starting a shell
workbloom setup feature/my-new-feature --no-shell
# Or using short alias: wb s feature/my-new-feature --no-shell

This will:

  1. Create a new worktree for the branch (creating the branch if it doesn't exist)
  2. Copy required files from the main repository (.env, .envrc, etc.)
  3. Setup direnv if available
  4. Start a new shell in the worktree directory (unless --no-shell is used)

Clean up worktrees

# Remove merged worktrees (default)
workbloom cleanup
# Or using short alias: wb c

# Force removal of merged worktrees (skip remote branch checks)
workbloom cleanup --merged --force
# Or using short alias: wb c --merged --force

# Remove worktrees matching a pattern
workbloom cleanup --pattern "feature/old-"
# Or using short alias: wb c --pattern "feature/old-"

# Interactive cleanup
workbloom cleanup --interactive
# Or using short alias: wb c --interactive

# Show merge status of all worktrees
workbloom cleanup --status
# Or using short alias: wb c --status

Cleanup Options

  • Default: Removes only merged worktrees that exist on the remote repository
  • --force: Skips remote branch checks and removes all merged worktrees (use with caution)
    • Useful when remote branches have been deleted after merging
    • Still protects recently created worktrees (within 24 hours)
  • --pattern: Removes worktrees matching the specified pattern
  • --interactive: Prompts for confirmation before removing each worktree
  • --status: Shows the merge status of all branches without removing anything

Configuration

Default Files

By default, Workbloom copies the following files to new worktrees:

  • .envrc
  • .env
  • .claude/settings.json
  • .claude/settings.local.json

Custom File Copying

You can specify additional files and directories to copy by creating a .workbloom file in your repository root:

# .workbloom - List of files and directories to copy to git worktrees
# One file or directory per line
# Lines starting with # are comments
# Directories should end with /

# Example:
service-account.json
config/database.yml
.secret/credentials.json
certificates/

See .workbloom.example for a complete example.

Development

# Run tests
cargo test

# Build debug version
cargo build

# Build release version
cargo build --release

# Run with debug output
RUST_LOG=debug cargo run -- setup test-branch

Claude Comment Management

古いClaudeのPRレビューコメントが蓄積することを防ぐため、自動的に最小化する機能を提供します。

自動実行

GitHub Actionsが以下の場合に自動実行されます:

  • PR作成・更新時
  • PRコメント作成時

手動実行

cd scripts
npm install

# PR #123の古いClaudeコメントを最小化
node claude-comment-manager.js 123

# 詳細な使用方法
node claude-comment-manager.js --help

詳細については scripts/README.md を参照してください。

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •