Summary
Currently, the plugin only tracks worktrees that are explicitly registered in .quick-pr-studio/worktrees.json via the "Start Step-by-Step PR" workflow. Worktrees created manually (e.g., via git worktree add in .quick-pr-studio/worktrees/) are not visible in the sidebar since there is no auto-discovery mechanism.
Proposed Feature
Automatically discover git worktrees inside .quick-pr-studio/worktrees/ and register them in worktrees.json so they appear in the sidebar TreeView.
Triggers
- On extension activation — Scan
.quick-pr-studio/worktrees/ for git worktrees and add any unregistered ones to the registry.
- Periodic refresh — A timer (e.g., every 30-60 seconds) or a debounced watcher on the worktrees directory to pick up newly created worktrees.
Details
- When a worktree directory is found in
.quick-pr-studio/worktrees/<name>/ but has no corresponding entry in worktrees.json, create a WorktreeInfo entry for it with reasonable defaults:
id: derived from the directory/branch name
branchName: extracted from the worktree's git branch
worktreePath: the full path
status: created (default)
- Other fields populated with sensible defaults or left empty
- When a worktree directory is removed but still exists in
worktrees.json, optionally clean up the stale entry.
- The periodic timer should be efficient — avoid excessive filesystem scanning (e.g., check mtime on the directory before re-scanning).
Why
This makes the sidebar consistent with the actual state of worktrees on disk, and allows users to manage manually-created worktrees through the plugin UI (commit, finalize, delete).
Files to Modify
src/worktreeManager.ts — Add a discoverWorktrees() function that scans .quick-pr-studio/worktrees/ and merges unregistered entries
src/extension.ts — Call discoverWorktrees() on activation and set up a periodic timer
Summary
Currently, the plugin only tracks worktrees that are explicitly registered in
.quick-pr-studio/worktrees.jsonvia the "Start Step-by-Step PR" workflow. Worktrees created manually (e.g., viagit worktree addin.quick-pr-studio/worktrees/) are not visible in the sidebar since there is no auto-discovery mechanism.Proposed Feature
Automatically discover git worktrees inside
.quick-pr-studio/worktrees/and register them inworktrees.jsonso they appear in the sidebar TreeView.Triggers
.quick-pr-studio/worktrees/for git worktrees and add any unregistered ones to the registry.Details
.quick-pr-studio/worktrees/<name>/but has no corresponding entry inworktrees.json, create aWorktreeInfoentry for it with reasonable defaults:id: derived from the directory/branch namebranchName: extracted from the worktree's git branchworktreePath: the full pathstatus:created(default)worktrees.json, optionally clean up the stale entry.Why
This makes the sidebar consistent with the actual state of worktrees on disk, and allows users to manage manually-created worktrees through the plugin UI (commit, finalize, delete).
Files to Modify
src/worktreeManager.ts— Add adiscoverWorktrees()function that scans.quick-pr-studio/worktrees/and merges unregistered entriessrc/extension.ts— CalldiscoverWorktrees()on activation and set up a periodic timer