Project-specific cleanup hook for worktree removal #147

Closed
opened 2026-01-17 10:19:01 +00:00 by mprihoda · 1 comment
mprihoda commented 2026-01-17 10:19:01 +00:00 (Migrated from github.com)

Add a cleanup hook that runs when removing a worktree via './iw rm'.

Problem:

  • Processes like SBT server keep running after worktree removal
  • Docker containers started in the worktree remain running
  • Have to recreate the worktree just to stop these processes

Solution:

  • Allow projects to define a cleanup script/command (e.g., .iw/hooks/cleanup or .iw/commands/cleanup)
  • Invoke it automatically before worktree removal
  • Should handle: stopping build servers, docker-compose down, killing background processes, etc.
  • Project-specific since cleanup needs vary by tech stack
Add a cleanup hook that runs when removing a worktree via './iw rm'. Problem: - Processes like SBT server keep running after worktree removal - Docker containers started in the worktree remain running - Have to recreate the worktree just to stop these processes Solution: - Allow projects to define a cleanup script/command (e.g., .iw/hooks/cleanup or .iw/commands/cleanup) - Invoke it automatically before worktree removal - Should handle: stopping build servers, docker-compose down, killing background processes, etc. - Project-specific since cleanup needs vary by tech stack
mprihoda commented 2026-06-12 16:23:32 +00:00 (Migrated from github.com)

Superseded by #382, which consolidates this (project-defined cleanup hook) with #225 (build-tool-daemon driver) into a single CleanupAction design that fits the existing hook-discovery pattern (#331). Implementation will land on #382.

Superseded by #382, which consolidates this (project-defined cleanup hook) with #225 (build-tool-daemon driver) into a single `CleanupAction` design that fits the existing hook-discovery pattern (#331). Implementation will land on #382.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
iterative-works/iw-cli#147
No description provided.