Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Add pre-remove hook to clean up background processes (#384)

Maximilian Roos79203970c951
diff --git a/.config/wt.toml b/.config/wt.toml
index 005d7af76..a4320fcf1 100644
--- a/.config/wt.toml
+++ b/.config/wt.toml
@@ -22,3 +22,6 @@ doc = "RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps"
[list]
url = "http://127.0.0.1:{{ branch | hash_port }}"
+
+[pre-remove]
+docs = "lsof -ti :{{ branch | hash_port }} | xargs kill 2>/dev/null || true"
diff --git a/docs/content/tips-patterns.md b/docs/content/tips-patterns.md
index f6095dbf6..02fe2a18b 100644
--- a/docs/content/tips-patterns.md
+++ b/docs/content/tips-patterns.md
@@ -41,6 +41,9 @@ server = "npm run dev -- --port {{ branch | hash_port }}"
[list]
url = "http://localhost:{{ branch | hash_port }}"
+
+[pre-remove]
+server = "lsof -ti :{{ branch | hash_port }} | xargs kill 2>/dev/null || true"
```
The URL column in `wt list` shows each worktree's dev server:
diff --git a/docs/demos/tapes/wt-zellij-omnibus.tape b/docs/demos/tapes/wt-zellij-omnibus.tape
index 609a3fa3d..0dee67c6a 100644
--- a/docs/demos/tapes/wt-zellij-omnibus.tape
+++ b/docs/demos/tapes/wt-zellij-omnibus.tape
@@ -198,3 +198,10 @@ Sleep 3s
# Done!
Type "done!"
Sleep 1.5s
+
+Hide
+# Clean up zellij after recording stops
+Ctrl+Space
+Sleep 200ms
+Type "q"
+Sleep 500ms