Skip to content

Commit 7e8ff1b

Browse files
committed
refactor: simplify to menu-only interface with comprehensive docs and fixes
1 parent 71b83f1 commit 7e8ff1b

32 files changed

+3968
-1556
lines changed

.git-workers.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Git Workers configuration file
2+
3+
[repository]
4+
# Repository URL for identification (optional)
5+
# This ensures hooks only run in the intended repository
6+
url = "https://github.com/wasabeef/git-workers.git"
7+
8+
[hooks]
9+
# Run after creating a new worktree
10+
post-create = [
11+
"echo '🤖 Created worktree: {{worktree_name}}'",
12+
"echo '🤖 Path: {{worktree_path}}'"
13+
]
14+
15+
# Run before removing a worktree
16+
pre-remove = [
17+
"echo '🤖 Removing worktree: {{worktree_name}}'"
18+
]
19+
20+
# Run after switching to a worktree
21+
post-switch = [
22+
"echo '🤖 Switched to: {{worktree_name}}'"
23+
]

CHANGELOG.md

Lines changed: 80 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,86 @@
11
# Changelog
22

3-
Please see [GitHub Releases](https://github.com/wasabeef/git-workers/releases) for the complete changelog.
3+
All notable changes to Git Workers will be documented in this file.
44

5-
Each release includes:
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
67

7-
- Detailed release notes generated from commit history
8-
- Binary downloads for all supported platforms
9-
- Installation instructions
8+
For detailed release notes and binary downloads, see [GitHub Releases](https://github.com/wasabeef/git-workers/releases).
109

11-
The release notes are automatically generated using conventional commits, categorizing changes into:
10+
## [Unreleased]
1211

13-
- Features
14-
- Bug Fixes
15-
- Documentation
16-
- Performance improvements
17-
- And more
12+
### Changed
13+
14+
- **BREAKING**: Removed command-line argument options (--list, --create, etc.) in favor of interactive menu-only interface
15+
- Simplified main.rs to focus solely on interactive menu operations
16+
- Improved worktree rename functionality with `git worktree repair` integration
17+
- Enhanced configuration lookup strategy:
18+
- Now checks current directory first (useful for bare repo worktrees)
19+
- Then checks parent directory's main/master worktree
20+
- Finally falls back to repository root
21+
- Improved path handling for worktree creation:
22+
- Paths are now canonicalized to eliminate "../" in display
23+
- "In subdirectory" option now correctly creates worktrees in subdirectories
24+
25+
### Added
26+
27+
- Edit hooks menu option (`λ`) for managing lifecycle hooks through the interface
28+
- Comprehensive Rustdoc documentation for all modules and functions
29+
- Current directory configuration lookup priority for .git-workers.toml
30+
- Parent directory configuration lookup for .git-workers.toml
31+
- Better error handling with mutex poison recovery in tests
32+
- Branch deletion functionality in batch delete operations
33+
- Orphaned branch detection when deleting worktrees
34+
- Repository URL validation in configuration files
35+
- New test files for batch delete and edit hooks functionality
36+
37+
### Fixed
38+
39+
- All clippy warnings resolved:
40+
- manual_div_ceil replaced with div_ceil() method
41+
- manual_unwrap_or patterns simplified
42+
- needless_borrows in format! macros removed
43+
- useless_vec replaced with arrays
44+
- manual_flatten replaced with .flatten() method
45+
- Test failures related to parent directory configuration search
46+
- ESC cancellation pattern tests updated for new code style
47+
- Worktree rename test expectations aligned with Git limitations
48+
- "In subdirectory" option now correctly creates worktrees in worktrees/ folder
49+
- Path display now shows clean canonical paths without "../"
50+
- Batch delete now properly deletes orphaned branches
51+
- Edit hooks no longer incorrectly identifies regular repos as bare
52+
53+
### Documentation
54+
55+
- Updated README.md with current features and usage:
56+
- Added configuration file lookup priority documentation
57+
- Updated worktree pattern examples
58+
- Added custom path creation examples
59+
- Added repository URL configuration example
60+
- Clarified batch delete branch deletion functionality
61+
- Enhanced CLAUDE.md with architectural details and development commands
62+
- Added detailed inline documentation for all public APIs
63+
- Updated all Rustdoc comments to reflect recent changes
64+
65+
## [0.1.0] - 2024-12-17
66+
67+
### Added
68+
69+
- Initial release of Git Workers
70+
- Interactive menu-driven interface for Git worktree management
71+
- List worktrees with detailed status information (branch, changes, ahead/behind)
72+
- Fuzzy search through worktrees with real-time filtering
73+
- Create new worktrees from branches or HEAD
74+
- Delete single or multiple worktrees with safety checks
75+
- Switch worktrees with automatic directory change via shell integration
76+
- Rename worktrees and optionally their branches
77+
- Cleanup old worktrees by age
78+
- Hook system for lifecycle events (post-create, pre-remove, post-switch)
79+
- Shell integration for Bash and Zsh
80+
- Configuration file support (.git-workers.toml)
81+
- Template variable support in hooks ({{worktree_name}}, {{worktree_path}})
82+
- Worktree pattern detection for organized directory structure
83+
- ESC key support for cancelling operations
84+
- Colored terminal output with theme support
85+
- Progress indicators for long operations
86+
- Homebrew installation support

CLAUDE.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ cargo test test_name
3232

3333
# Run tests single-threaded (for flaky tests)
3434
cargo test -- --test-threads=1
35+
36+
# Run tests with output for debugging
37+
cargo test test_name -- --nocapture
3538
```
3639

3740
### Quality Checks
@@ -46,6 +49,9 @@ cargo clippy --all-features -- -D warnings
4649

4750
# Type check
4851
cargo check --all-features
52+
53+
# Generate documentation
54+
cargo doc --no-deps --open
4955
```
5056

5157
### Installation
@@ -75,6 +81,7 @@ src/
7581
├── hooks.rs # Hook system (post-create, pre-remove, etc.)
7682
├── repository_info.rs # Repository information display
7783
├── input_esc_raw.rs # Custom input handling with ESC support
84+
├── constants.rs # Centralized constants (strings, formatting)
7885
└── utils.rs # Common utilities (error display, etc.)
7986
```
8087

@@ -107,14 +114,12 @@ post-switch = ["echo 'Switched to {{worktree_name}}'"]
107114
```
108115

109116
Template variables:
110-
111117
- `{{worktree_name}}`: The worktree name
112118
- `{{worktree_path}}`: Absolute path to worktree
113119

114120
### Worktree Patterns
115121

116122
First worktree creation offers two options:
117-
118123
1. Same level as repository: `../worktree-name`
119124
2. In subdirectory (recommended): `../repo/worktrees/worktree-name`
120125

@@ -123,15 +128,13 @@ Subsequent worktrees follow the established pattern automatically.
123128
### ESC Key Handling
124129

125130
All interactive prompts support ESC cancellation through custom `input_esc_raw` module:
126-
127131
- `input_esc_raw()` returns `Option<String>` (None on ESC)
128132
- `Select::interact_opt()` for menu selections
129133
- `Confirm::interact_opt()` for confirmations
130134

131135
### Worktree Rename Implementation
132136

133137
Since Git lacks native rename functionality:
134-
135138
1. Move directory with `fs::rename`
136139
2. Update `.git/worktrees/<name>` metadata directory
137140
3. Update gitdir files in both directions

0 commit comments

Comments
 (0)