Repository navigation
[Feature]: Run a project action before worktree removal (runOnWorktreeRemove), for resources outside the worktree
#14804
mateosayas
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Before submitting
Area
apps/server
Problem or use case
runOnWorktreeCreatecan start resources that live outside the worktree, for example a per-worktree Postgres container (docker compose -p <slug> up). There is no matching hook for removal.When a thread is deleted in the UI, T3 Code removes the worktree directory, but the container and its volume stay. They accumulate until Docker consumes most of the machine's RAM and disk.
The teardown needs state that lives in the worktree (in our case a
.dev/workspace.envholding the compose project name). Once the directory is gone, that state is gone too, so a cleanup after the fact cannot work reliably.Proposed solution
Add an optional project action flag,
runOnWorktreeRemove, that:git worktree removeT3CODE_WORKTREE_PATH/T3CODE_PROJECT_ROOT, like the create actionSmallest useful scope
Run the flagged action before
git worktree removeon manual thread delete. The other removal paths can follow.Alternatives considered
Examples or references
Contribution
All reactions