Add ⌘P worktree switcher (VS Code-style) with worktree MRU#1
Open
COCPORN wants to merge 3 commits into
Open
Conversation
Adds a worktree switcher on ⌘P and moves the existing Command Palette to ⌘⇧P, aligning with VS Code (⌘⇧P = Command Palette; ⌘P = fast navigation). Both shortcuts remain user-rebindable via shortcut overrides. Reworked from the original project switcher per the PR supabitapp#370 review: Supacode's core use case is multi-worktree-per-repo, where a project-level switcher collapses the whole history down to one entry per repo and loses the worktree you actually had open. Worktrees are the primary rows instead. - ⌘P opens a fuzzy switcher of every worktree, ordered most-recently-used (RepositoriesFeature.State.worktreeMRU). The current worktree is rendered (so you see where you are) but flagged `isCurrentWorktree` so the default selection lands on the *previous* worktree — ⌘P then Enter is a Cmd+Tab-style toggle. Typing fuzzy-matches the combined `repo / worktree` title, so a query hits either the project name or the worktree name. - worktreeMRU is recorded on BOTH navigation paths — setSingleWorktreeSelection (hotkeys/palette) and reduceSelectionChangedEffect (sidebar clicks) — so it tracks however you navigate. Single-worktree repos behave exactly as the original project switcher did. - New PaletteMode (.commands / .worktreeSwitcher). The switcher emits `selectWorktree` directly (no project→worktree resolution step), so activation lands focus in the chosen terminal; cancelling refocuses the current terminal. Covered by CommandPaletteFeatureTests (switcher ordering/flagging, MRU sort, combined title, mode dispatch) and RepositoriesFeatureWorktreeMRUTests (MRU recording on both nav paths). Implemented with AI assistance (Claude Code). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The `setup-macos` Tuist auth step was gated to skip only cross-fork PRs, so an intra-fork PR (or a push to a fork's main) still tried `tuist auth login` and failed with `notAuthenticated` / "No projects linked to the repository" — the fork isn't linked in the Tuist dashboard. That blocked the whole build job before lint/build/test ran. Tuist auth is OIDC against the canonical upstream project and only buys the remote cache; `tuist generate` (and thus the build) works without it — the cross-fork-PR path already relies on this. Gate auth on the upstream repo so forks (and cross-fork PRs) skip it and can run the full build+test job. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The worktree switcher records every concrete selection into the new `worktreeMRU` state on both nav paths (setSingleWorktreeSelection and reduceSelectionChangedEffect). TestStore checks state exhaustively, so the 27 selection/history tests that drive those paths now see an unasserted change. Assert the new MRU head in each — selecting worktree W prepends W; nil/archived selections leave it untouched (those tests already pass and are unchanged). Behavior change is intentional (the switcher's whole point), so the tests follow. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.
What
Reworks the
⌘Pswitcher from projects to worktrees, per the PR supabitapp#370 review (sbertix). Command Palette stays on⌘⇧P.Why
Supacode's core use case is multi-worktree-per-repo. A project-level switcher collapses the whole nav history down to one entry per repo and loses the worktree you actually had open. Worktrees are the primary rows instead.
Behavior
⌘Popens a fuzzy switcher of every worktree, ordered most-recently-used (worktreeMRU). The current worktree renders but is flaggedisCurrentWorktree, so⌘Pthen Enter is a Cmd+Tab-style toggle to the previous worktree.repo / worktreetitle — hits either the project name or the worktree name.selectWorktreedirectly (no project→worktree resolution step); cancelling refocuses the current terminal.Tests
RepositoriesFeatureWorktreeMRUTests(MRU recording on both nav paths) and switcher cases inCommandPaletteFeatureTests(ordering, current-flag, multi-worktree listing, combined title, mode dispatch).Note
This is an intra-fork PR for CI verification (build + tests). Local builds are dead on this Mac (Zig/libSystem on macOS 26.x), so CI is the only build path.
🤖 Generated with Claude Code