Skip to content

feat/worktree picker modal#109

Merged
forketyfork merged 7 commits intomainfrom
feat/worktree-picker-modal
Jan 14, 2026
Merged

feat/worktree picker modal#109
forketyfork merged 7 commits intomainfrom
feat/worktree-picker-modal

Conversation

@forketyfork
Copy link
Owner

  • Worktree support 1
  • feat: worktree picker modal Prompt: Okay, I have a hard one for you. This branch contains worktree support implementation, but I'm hitting my head on the UX. What I'd like to happen: when the user selects the worktree, the working directory of the terminal should switch to this worktree; I don't want to respawn the terminal, I only want to switch the working directory. The problem is that some process may run in the shell. If that's the case, then we shouldn't even show the T pill. But if we're in the shell without any processes running, then we should show the pill and cd to a worktree if the user selects one. Can we implement this? Solution: Switched worktree selection to in-shell cd with Cmd+T overlay hiding when a process runs; limited list to 9 plus Cmd+0 new-worktree modal styled like quit dialog with backdrop; modal creates git worktree under .architect/, cds into it; improved hover gradient and kept help pill labeled ⌘? while hotkey remains Cmd+/, docs updated.

Prompt: Okay, I have a hard one for you. This branch contains worktree support implementation, but I'm hitting my head on the UX. What I'd like to happen: when the user selects the worktree, the working directory of the terminal should switch to this worktree; I don't want to respawn the terminal, I only want to switch the working directory.
The problem is that some process may run in the shell. If that's the case, then we shouldn't even show the T pill. But if we're in the shell without any processes running, then we should show the pill and cd to a worktree if the user selects one.
Can we implement this?
Solution: Switched worktree selection to in-shell cd with Cmd+T overlay hiding when a process runs; limited list to 9 plus Cmd+0 new-worktree modal styled like quit dialog with backdrop; modal creates git worktree under .architect/<name>, cds into it; improved hover gradient and kept help pill labeled ⌘? while hotkey remains Cmd+/, docs updated.
Resolved conflicts:
- README.md: Combined worktree picker feature description with trackpad scroll improvements
- src/ui/types.zig: Merged UiAction enum to include SwitchWorktree, CreateWorktree, and DespawnSession actions
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dde3e5b542

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +999 to +1003
fn readTrimmedFile(self: *WorktreeOverlayComponent, path: []const u8) ![]const u8 {
const file = try std.fs.openFileAbsolute(path, .{});
defer file.close();
const contents = try file.readToEndAlloc(self.allocator, 4096);
return std.mem.trim(u8, contents, " \t\r\n");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Return owned trimmed buffer from readTrimmedFile

readTrimmedFile returns std.mem.trim(...) over the allocated buffer and callers later allocator.free that slice (e.g., in collectFromGitMetadata and findGitContext). trim can change both pointer and length, so freeing it is undefined and can corrupt the allocator or crash when the file contains the usual trailing newline. This is user-triggerable as soon as the worktree picker reads .git metadata. Consider returning an owned copy of the trimmed bytes (or trim in place and return the original allocation) so the slice handed to free matches the allocation.

Useful? React with 👍 / 👎.

- Add full-window backdrop to new worktree modal (matching quit dialog)
- Fix ESC key handling to prevent leaking to terminal
- Display "[repository root]" instead of "." for main worktree
- Implement dynamic vertical sizing for both overlays based on content
- Fix diagonal animation (width and height expand proportionally)
- Improve hover highlighting with accent color and edge fade-out
- Add left-side text truncation with ellipsis for long worktree names
- Validate worktree name input (alphanumeric, dash, underscore only)
- Increase overlay background opacity for better visibility
- Change placeholder text from "branch-name" to "name"
Adds a flowing, diffused blue line animation that highlights the currently
active worktree in the overlay:

- Multi-wave animation using 4 overlapping sine/cosine waves at different
  frequencies for organic, non-repetitive motion
- 9-layer diffusion system for soft, glowing appearance
- Uses accent color (blue) to match border aesthetic
- Slow flow speed (0.5) for subtle, elegant animation
- Animation lifecycle tied to overlay open/close state
- Continuous 60fps rendering when overlay is open

Also improves worktree list management:
- Repository root always positioned first in the list
- Remaining worktrees sorted alphabetically
- List capped at 9 worktrees (10 total including "New worktree" entry)
- Root + 8 sorted worktrees for consistent UX
Only show actual git worktree roots, not subdirectories within them.
Removed the logic that was adding the current working directory as
a worktree entry since we already collect all actual worktrees from
git metadata.
@forketyfork forketyfork merged commit c58c31e into main Jan 14, 2026
7 checks passed
@forketyfork forketyfork deleted the feat/worktree-picker-modal branch January 14, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant