Create git worktree manager CLI tool#6
Merged
Conversation
Implements a comprehensive CLI tool for managing git worktrees with the following features: - Simple worktree management: init, switch, list, delete, status - Smart defaults with configurable branch prefixes and path patterns - Shell integration for seamless cd support (bash, zsh, fish) - Status tracking across all worktrees - Auto-cleanup of merged/deleted worktrees - User prompts for safety (uncommitted changes, unpushed commits) Technical details: - Python 3.10+ with Click CLI framework - Subprocess-based git operations (no external git library) - TOML configuration (local and global) - 57 tests with 63% coverage - All commands fully implemented per spec Documentation: - README.md with comprehensive usage examples - PRD.md with completed stories and tasks - notes.md documenting implementation decisions and challenges
…10-3.12 - Add wt-worktree to test matrix - Test all tools across Python 3.10, 3.11, and 3.12 - Update step name to show Python version being tested
Problem: When running wt commands from a secondary worktree, the tool would ask to run 'wt init' again because it couldn't find .wt.toml. Root cause: git rev-parse --show-toplevel returns the current worktree's root directory, not the main worktree root where .wt.toml is stored. Solution: - Added get_main_worktree_root() function in git.py - Uses 'git worktree list' to find the main worktree (always first) - Updated CLI to use main worktree root for config loading - Added test to verify commands work from secondary worktrees Changes: - wt/git.py: Added get_main_worktree_root() function - wt/cli.py: Use get_main_worktree_root() instead of get_repo_root() - tests/test_cli.py: Added test_commands_from_secondary_worktree - notes.md: Documented the issue and solution Tests: 58 tests pass (added 1 new test) Coverage: git.py increased from 83% to 86%
BREAKING CHANGE: Config is now stored globally in ~/.wt.toml instead of per-repository .wt.toml files. Motivation: - Simpler design - one config location for all repositories - No need to find main worktree when running from secondary worktrees - Works the same everywhere - Removes the need to run 'wt init' per repository Changes: - Config now stored in $WT_CONFIG/.wt.toml (defaults to ~/.wt.toml) - Removed local repo config concept - 'wt init' is now optional (just sets custom defaults globally) - Removed is_initialized() check - tool works out of the box - Updated CLI to not require initialization - Simplified config module: - Removed save_local() and save_global() - Added single save() method - Removed get_local_config_path() - Added get_config_path() and get_config_dir() Tests updated: - All fixtures now use temp config directories via WT_CONFIG env var - Updated test_init to test global config creation - Removed tests for local config and is_initialized - Added tests for config directory resolution - All 58 tests passing Documentation updated: - README: Made 'wt init' optional, updated config section - notes.md: Documented the simplification rationale - Updated all command examples Benefits: - Simpler user experience (no init needed) - Works from any worktree without issues - Easier to understand and maintain - Consistent configuration across all repositories
The wt run command now properly handles the '^' symbol to reference the default worktree, consistent with how wt switch handles it. Changes: - Added special handling for '^' in run command (cli.py) - Added three new tests for run command functionality - Updated notes.md with implementation details Fixes issue where 'wt run ^ "git status"' would error with "Worktree '^' not found" instead of running in the default worktree. All 61 tests passing. Co-authored-by: Claude <noreply@anthropic.com>
- Removed the confirmation prompt when switching with uncommitted changes - Users can now switch freely between worktrees without interruption - This is more aligned with git's worktree behavior (git allows switching) - Tests still pass (61 tests) - Coverage improved to 66%
Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a comprehensive CLI tool for managing git worktrees with the following features:
Technical details:
Documentation: