Feature request for product/service
Cursor IDE
Describe the request
Problem:
The existing setup-worktree hook allows running scripts when a worktree is created, but there’s no corresponding cleanup hook when worktrees are deleted. This leads to orphaned resources (e.g., Docker containers) that were created during worktree initialization.
Use Case:
When using setup-worktree to start worktree-specific Docker Compose services, these containers persist after the worktree is cleaned up, resulting in resource leaks and cluttered environments.
Proposed Solution:
Add delete-worktree, delete-worktree-unix, and delete-worktree-windows hooks that:
- Run automatically when a worktree is deleted/cleaned up
- Follow the same pattern and behavior as the existing setup-worktree hooks
- Execute before the worktree directory is removed
Example Usage:
{
"setup-worktree-unix": "./scripts/start-worktree-services.sh",
"delete-worktree-unix": "./scripts/cleanup-worktree-services.sh"
}
This would enable proper cleanup of worktree-specific resources, mirroring the initialization capabilities already provided.