Repository navigation
feat(worktrees): pick up worktrees a repository already has - #919
Merged
Merged
Conversation
A repository often has worktrees Threadlines did not make (git worktree add, or another app). They only showed in the branch picker, with no way to carry on in them as threads. Right after such a repository is added, the new-thread screen lists them under the message box with a checkbox each; "Add N threads" makes a thread per ticked worktree, named from its branch, and nothing runs. Later visits show a count beside the recent threads that opens into rows with "Work here". The Workspace picker lists them under "Existing worktree", and the command palette can lay the list out again. A thread in one is a guest (ThreadWorktreeOrigin `existing`): no branch rename, no setup script, deleting it never offers to remove the folder, cleanup never pre-ticks it, and undo only reverts the thread's own edits. The branch picker and the Source panel mark a thread they send into one. vcs.listWorktrees can leave out Threadlines' own worktrees and can name worktrees without reading them: reading costs a git status each, about seven seconds on a repository with 34, so only a list that is shown asks. Design note: docs/design/worktree-pickup.md.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
The problem
A repository often already has worktrees Threadlines did not make:
git worktree addby hand, or another app that keeps one per task. They only showed in the branch picker, each with a small "worktree" label. There was no way to carry on in them as threads, and nothing stopped Threadlines from treating those folders as its own.What this adds
Only worktrees outside Threadlines' own worktrees folder count, and only ones no thread works in yet.
A guest, not an owner
A thread in one of these worktrees carries
ThreadWorktreeOrigin{ kind: "existing" }, the marker a thread lent another thread's worktree already has. So the first turn never renames the branch, no setup script runs, deleting the thread never offers to remove the folder, the cleanup dialog never pre-ticks it, and undo only reverts the thread's own edits. A thread continuing in a guest's worktree is a guest too. The branch picker and the Source panel send the marker when they point a thread at one.How it is built
vcs.listWorktreestakesscope: "elsewhere"(leaves out the main checkout and Threadlines' own worktrees before any per-worktree work) andstatuses: false(names only). Reading a worktree costs agit statusthere, about seven seconds on a repository with 34 worktrees, so the count, the menus and the palette ask for names and only a list that is shown asks for statuses.thread.createacceptsworktreeOrigin: { kind: "existing" }from a client (never without a worktree path;kind: "thread"stays server-only).thread.checkout.selecttakesexistingWorktree.worktreePickupcapability. Without it the client asks for nothing and sends no marker.docs/design/worktree-pickup.md. The app guide's "Threads and worktrees" topic covers it.Known limits
worktreeOriginas the one-member struct and rejectskind: "existing". No stable release has that schema; it needs a nightly from that window linked to a newer computer.Checked
vp fmt,vp lint,vp run typecheck, the full unit suite, the full browser suite, and the startup size check (891,290 B against 915,000). Walked every screen in the real app against a scratch repository with four worktrees, in light, dark and phone layouts. Not run: a real agent turn inside a picked-up thread.