@ry-itto/wt
v1.2.2
Published
Git worktree operations wrapper with interactive interface
Downloads
22
Readme
wt
TypeScript-based git worktree management tool with interactive selection and shell integration.
Features
- 🚀 Interactive worktree selection with fzf
- 📁 Smart directory navigation with automatic cd
- 🪝 Pre/post operation hooks (global and repository-specific)
- 🛠 TypeScript implementation with comprehensive tests
- 🐚 Self-generating shell integration
- 🔄 Robust directory change mechanism (inspired by git-workers)
- 🔗 GitHub integration for PR-based workflow
- 🧹 Automatic cleanup of merged worktrees
Installation
Global Installation (Recommended)
# Install globally via npm
npm install --global @ry-itto/wt
# Generate and load shell integration
eval "$(wt shell-init)"
# Or save permanently
wt shell-init > ~/.wt-integration.zsh
echo "source ~/.wt-integration.zsh" >> ~/.zshrcLocal Development Setup
# Clone and build locally
git clone <repo-url>
cd wt
npm install && npm run build
# Generate shell integration
node dist/index.js shell-init > ~/.wt-integration.zsh
# Add to your shell configuration
echo "source ~/.wt-integration.zsh" >> ~/.zshrcQuick Start
# Interactive worktree selection and navigation
wt
# List all worktrees
wt list
# Create new worktree
wt add
# Remove worktree
wt remove
# Clean up merged worktrees
wt prune詳細なコマンドリファレンスは docs/commands.md を参照してください。
Documentation
- コマンドリファレンス - すべてのコマンドの詳細な使い方
- シェル統合 - シェル統合の仕組みとセットアップ
- フックシステム - カスタムスクリプトによる自動化
- GitHub 統合 - Pull Request ベースのワークフロー
- アーキテクチャ - 内部設計と実装詳細
- 開発ガイド - コントリビューション方法
- テストガイド - テストの書き方と実行方法
Advanced Features
Hook System
worktree の作成・削除時にカスタムスクリプトを自動実行できます。
# 依存関係の自動インストール例
cat > ~/.zsh/hooks/wt/post-add << 'EOF'
#!/bin/zsh
if [[ "$4" == "true" && -f "$2/package.json" ]]; then
(cd "$2" && npm install)
fi
EOF
chmod +x ~/.zsh/hooks/wt/post-add詳細は docs/hooks.md を参照してください。
GitHub Integration
GitHub CLI を使用した PR ベースのワークフローをサポート:
# PR があるブランチのみ表示
wt add --pr-only
# マージ済み PR の worktree を削除
wt prune詳細は docs/github-integration.md を参照してください。
Development
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Type check
npm run typecheck
# Lint
npm run lint開発の詳細は docs/development.md を参照してください。
Testing
# Unit tests
npm run test:unit
# E2E tests
npm run test:e2e
# Shell integration tests
npm run test:shell
# Docker environment (isolated)
npm run test:dockerテストの詳細は docs/testing.md を参照してください。
