Problem
Currently, worktrees created manually or from outside the extension are not recognized by Quick PR Studio. When the extension starts, it only shows worktrees that were previously tracked in worktrees.json. If the .quick-pr-studio/worktrees/ directory contains worktree directories (created manually or left over from a previous session), they remain invisible in the sidebar.
Proposed Solution
On extension activation, scan the <project-root>/.quick-pr-studio/worktrees/ directory and register any existing worktrees that are not already tracked in worktrees.json. This ensures:
- Worktrees created outside the extension (e.g., via CLI) appear in the sidebar
- Worktrees from a prior session are automatically recovered, even if
worktrees.json was lost or corrupted
- Consistent state between disk and the extension's tracking metadata
Implementation Notes
- Use
git worktree list to verify each directory under .quick-pr-studio/worktrees/ is still a valid git worktree
- Add only valid worktrees to the worktree manager
- Log a warning for any directories that exist but are no longer valid worktrees
- This should happen during extension activation, after the worktree manager is initialized
Acceptance Criteria
Problem
Currently, worktrees created manually or from outside the extension are not recognized by Quick PR Studio. When the extension starts, it only shows worktrees that were previously tracked in
worktrees.json. If the.quick-pr-studio/worktrees/directory contains worktree directories (created manually or left over from a previous session), they remain invisible in the sidebar.Proposed Solution
On extension activation, scan the
<project-root>/.quick-pr-studio/worktrees/directory and register any existing worktrees that are not already tracked inworktrees.json. This ensures:worktrees.jsonwas lost or corruptedImplementation Notes
git worktree listto verify each directory under.quick-pr-studio/worktrees/is still a valid git worktreeAcceptance Criteria
.quick-pr-studio/worktrees/are loaded and visible in the sidebarworktrees.json