Skip to content

✨ Worktree management and linking #2

@Robdel12

Description

@Robdel12

Summary

Add support for managing and linking git worktrees to workstreams. Worktrees are powerful but the scattered directories need UX wrangling.

Philosophy

OrbitDock adapts to you, not the other way around.

  • Works with worktrees wherever they live
  • Offers organization, doesn't mandate it
  • No rigid process - fluid and dynamic
  • Detect and surface, don't require

Features

Project Grouping (Priority)

  • Group worktrees under same repo in sidebar (use git rev-parse --git-common-dir)
  • Store repo_root in database alongside project_path
  • Display as single project with multiple working directories

Example: claude-dashboard and claude-dashboard-workstreams should show as one project since they're the same repo.

Detection & Linking

  • Detect existing worktrees via git worktree list
  • UI to manually link a worktree to a workstream
  • Auto-detect when git worktree add runs (via tool tracker hook)
  • Show worktree path in workstream detail view

Standardized Location (optional)

  • When OrbitDock creates a worktree, use ~/.orbitdock/worktrees/{repo}/{branch}
  • "Create worktree" button in UI (not required, just convenient)
  • Track worktrees OrbitDock created vs externally created

UI

  • Show all worktrees for a repo (regardless of location)
  • "Open in Terminal" → opens the worktree directory
  • "Open in Editor" → opens worktree in configured editor
  • Indicate which workstreams have linked worktrees

Cleanup

  • Surface stale worktrees (branch merged/deleted)
  • "Remove worktree" action (with confirmation)
  • Never auto-delete - always user-initiated

Non-goals

  • Don't require worktrees for workstreams
  • Don't force directory structure
  • Don't add friction to quick experiments
  • Don't auto-create worktrees without asking

Implementation Notes

  • git worktree list --porcelain gives machine-readable output
  • git rev-parse --git-common-dir returns main repo .git path (even from worktrees)
  • Workstream table already has directory column - can store worktree path
  • Hook can detect git worktree add same way we detect git checkout -b
  • lib/git.js already has getRepoRoot() that handles worktrees

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions