Add PR thread setup for local and worktree modes by juliusmarminge · Pull Request #718 · pingdotgg/t3code
bot
added
the
vouch:trusted
label
Mar 9, 2026- Add git APIs to resolve PR refs and prepare PR thread workspaces - Support fetching PR head refs into local branches and reusing existing worktrees - Wire new websocket/contracts/web composer flows for PR-based thread creation - Expand server/web/contracts tests for PR routing and branch/worktree behavior
- Add shared branch picker filtering logic and tests, including PR-reference-only results - Improve branch selector UX/perf with deferred query filtering, conditional virtualization, and status-based current branch resolution - Only expose and handle `/checkout-pr` for local draft threads in chat and toolbar UI
- add `resolveBranchSelectionTarget` to unify checkout cwd/worktree decisions - reuse existing worktrees when available, including switching back to main repo - update branch selector to use shared logic and add targeted unit tests
- add GitCore helpers to ensure remotes, fetch remote branches, and set upstreams - extend GitHub CLI parsing to include cross-repo PR metadata and repo clone URLs - update GitManager flow and tests to materialize fork heads and keep tracking on fork remotes
- Restore/set upstream tracking when preparing local and reused PR worktrees - Derive fork `owner/repo` from PR URL when GitHub omits `headRepositoryNameWithOwner` - Expand GitManager tests to cover local mode, URL-derived fork identity, and reused worktree upstream recovery
- Replace manual JSON parsing with shared schema-based decoding helpers - Normalize PR and repository payloads after decoding for safer typed outputs - Improve invalid JSON error mapping with operation-specific GitHubCliError details
- create a unique local branch name for cross-repo PR worktrees (`pr/<number>-<head>`) - fetch/set upstream against that local branch instead of overwriting local `main` - add regression tests for fork PRs where head branch is `main`
- Treat remotes that only differ by trailing slash after `.git` as the same remote - Add a GitCore regression test for trailing-slash remote reuse - Refactor `GitHubCli` tests to `@effect/vitest` layer-based effect tests with reset cleanup
- Wire `it.layer` to `GitHubCliLive` in `GitHubCli.test.ts` - Remove redundant `Effect.provide(GitHubCliLive)` calls in individual tests
- Change local PR worktree branch format from `pr/<number>-<head>` to `t3code/pr-<number>/<head>` - Update GitManager tests to assert the new branch naming convention
- Replace the inline composer PR menu with a dedicated `PullRequestThreadDialog` - Remove `/checkout-pr` from composer slash-command parsing and tests - Fix branch selector virtualization sizing for the checkout-PR row
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