Repository navigation
feat: delete a worktree from the Space actions menu - #328
Merged
Merged
Conversation
Deleting a worktree required the D screen, which lists every worktree and makes you find the one already highlighted in the menu. Space now opens the actions menu for the highlighted row and offers deleting that worktree directly. - Space opens the actions menu for any worktree row, not only rows with a session. Rename/Close are session-specific and stay hidden without one, so the menu title switches to "Worktree Actions". - The delete entry is hidden for worktrees that cannot be deleted (main worktree, and the worktree containing the current working directory) rather than shown and rejected. That rule moves into isDeletableWorktree() so the D screen and the new entry share one source. - Choosing it reuses DeleteConfirmation (uncommitted-changes warning, branch option, Cancel-by-default) and then the existing deletion path, which kills the worktree's sessions first. A failure returns to the menu with the error, since the multi-select screen was never opened here. The Dashboard entry point into the actions menu has only a session, no worktree, so it offers no deletion. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Conflicts came from #324, which added a "Directory: <path>" line to the session actions menu and a required worktreePath prop for it. - SessionActions keeps main's worktreePath prop and dedicated directory line, alongside the hasSession / canDeleteWorktree props of this branch. sessionLabel becomes optional, since a worktree row without a session has no session name to show and the path already has its own line. - App passes both: the label is main's session name / "Session #N" for a session row and undefined for a session-less one. Co-Authored-By: Claude Opus 5 (1M context) <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.
Why
Deleting a worktree required the
Dscreen, which lists every worktree and makes you locate the one that is already highlighted in the menu. Space now opens the row actions for the highlighted worktree and can delete it directly.What changed
isDeletableWorktree()insrc/utils/worktreeUtils.ts, and the existingDscreen now uses it too, so both paths share one source.DeleteConfirmation(uncommitted-changes warning, branch option, Cancel selected by default) followed byhandleDeleteWorktrees, which kills the worktree's sessions before removing it. On failure this flow returns to the menu with the error, because the multi-select delete screen was never opened here.MenuAction.sessionActionsnow carries theWorktreeinstead of a bareworktreePath(the path is read from it, so the two no longer duplicate each other).Verification
bun run lint,bun run typecheck: pass.bun run test: 1788 passed. The*.submodule.test.tsfiles fail inbeforeAllin my local environment becausegit config --global protocol.file.allow alwayscannot write~/.gitconfigthere; this is unrelated to the change (the prebuilt, unmodifieddistcopies of those tests fail identically). CI should run them normally.src/components/SessionActions.test.tsx(which entries are offered, hotkey dispatch), aMenu.test.tsxcase for Space on a session-less row, andisDeletableWorktreecases insrc/utils/worktreeUtils.test.ts.🤖 Generated with Claude Code