Skip to content

feat(penpal): live-detect worktree additions and removals#548

Draft
loganj wants to merge 1 commit intomainfrom
penpal-builderbot-worktree-dis
Draft

feat(penpal): live-detect worktree additions and removals#548
loganj wants to merge 1 commit intomainfrom
penpal-builderbot-worktree-dis

Conversation

@loganj
Copy link
Copy Markdown
Collaborator

@loganj loganj commented Mar 30, 2026

Summary

Previously, Penpal discovered git worktrees once at startup and never refreshed the list. If you ran git worktree add or git worktree remove while Penpal was running, the sidebar's worktree list went stale — showing deleted worktrees and missing new ones.

Now, Penpal watches each project's .git/worktrees/ directory for filesystem changes. When a worktree is added or removed, the worktree list updates automatically and the sidebar reflects the change within moments — no restart needed.

  • discovery/worktree.go — New GitWorktreesDir() resolves the .git/worktrees/ metadata directory via git rev-parse --git-common-dir, working for both main and linked worktrees
  • watcher/watcher.go — Base watches now include .git/worktrees/ dirs; events there trigger full re-discovery and an SSE broadcast so the frontend picks up the change
  • PRODUCT.md / ERD.md / TESTING.md — Added E-PENPAL-WORKTREE-WATCH requirement and updated P-PENPAL-WORKTREE to specify live updates

🤖 Generated with Claude Code

Watch each project's .git/worktrees/ directory so that `git worktree
add` and `git worktree remove` are detected without restarting the
server. On change, full re-discovery runs and an SSE event pushes the
updated worktree list to the frontend.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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