feat: rename worktree hooks with deprecation support#131
Merged
Conversation
Rename 4 worktree-scoped hooks with a `worktree-` prefix to better distinguish them from repo-scoped hooks. Old names remain functional with deprecation warnings until v2.0.0. Renames: - pre-create -> worktree-pre-create - post-create -> worktree-post-create - pre-remove -> worktree-pre-remove - post-remove -> worktree-post-remove post-clone and post-init are unchanged (repo-scoped). Key changes: - Hook filenames and config keys updated to new canonical names - Deprecated filenames discovered and executed with warnings - EXECUTE_DEPRECATED_HOOKS constant controls v2.0.0 cutoff - Config keys fall back to deprecated keys for backwards compat - `git daft hooks migrate` command renames old files automatically - `git daft hooks status` detects and warns about deprecated names - HookDiscovery struct replaces Vec<PathBuf> from find_hooks() Fixes #84 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The migrate command now requires running from within a worktree and only migrates hooks in that worktree's .daft/hooks/ directory, rather than scanning all worktrees and the user hooks directory. Co-Authored-By: Claude Opus 4.5 <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.
Summary
worktree-prefix (pre-create→worktree-pre-create, etc.) for claritygit daft hooks migratecommand to automatically rename deprecated hook filesgit daft hooks statusnow detects and warns about deprecated hook namesFixes #84
Details
post-clonepost-clone(unchanged)post-initpost-init(unchanged)pre-createworktree-pre-createpost-createworktree-post-createpre-removeworktree-pre-removepost-removeworktree-post-removeDeprecation behavior:
EXECUTE_DEPRECATED_HOOKSfromtruetofalseMigration command:
Scans all worktree
.daft/hooks/directories and~/.config/daft/hooks/, renames deprecated files, handles conflicts when both old and new names exist.Test plan
cargo test)cargo clippy -- -D warningspasses cleancargo fmt -- --checkpasses cleandeprecated_filename(),from_filename(),deprecated_config_key()🤖 Generated with Claude Code