Skip to content

feat(web): add "New chat in this worktree" header button - #10

Merged
enisze merged 1 commit into
mainfrom
t3code/add-worktree-thread-chats
Jul 30, 2026
Merged

feat(web): add "New chat in this worktree" header button#10
enisze merged 1 commit into
mainfrom
t3code/add-worktree-thread-chats

Conversation

@enisze

@enisze enisze commented Jul 30, 2026

Copy link
Copy Markdown
Owner

What

Adds an in-thread affordance to open a fresh chat pointed at the same worktree as the current thread.

When a thread runs in a worktree, a new button (message-plus icon, tooltip "New chat in this worktree") appears in the chat header. Clicking it opens a new draft chat seeded with the current thread's branch + worktreePath and envMode: "worktree", reusing the existing git worktree instead of provisioning a new one. On plain current-checkout threads the button is hidden.

Why

Multiple chats sharing one worktree was already supported by the data model (a chat is a thread; a worktree is just a worktreePath field) and already exposed via the sidebar's "New thread on {branch}" right-click action. This surfaces the same capability as a first-class button inside the open chat.

Changes

  • apps/web/src/components/chat/ChatHeader.tsx — optional onNewChatInWorktree prop + header icon button, rendered only when provided.
  • apps/web/src/components/ChatView.tsxhandleNewChatInWorktree wired to the existing handleNewThread(...), passed only when the thread has a worktree.

Reuses existing plumbing; worktree cleanup already guards against deleting a tree another chat still uses.

🤖 Generated with Claude Code

Surfaces an in-thread affordance to open a fresh chat pointed at the
current thread's worktree, reusing the existing git worktree instead of
provisioning a new one. Mirrors the sidebar's "New thread on {branch}"
action.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@enisze
enisze merged commit 6ee1a0b into main Jul 30, 2026
@enisze
enisze deleted the t3code/add-worktree-thread-chats branch July 30, 2026 15:56
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