Milestone 2.3: Overview #6

Open
opened 2026-07-24 03:22:35 +00:00 by david · 0 comments
Owner

Overview

Implement git_worktree_switch tool that switches pi's working directory to a linked worktree.

Acceptance Criteria

  • Validates input parameters (target path or branch name)
  • Resolves target to a path (if it's a branch name, look up the worktree path)
  • Refuses if already in that worktree: "Already in this worktree."
  • Fails fast with message about uncommitted changes
  • Changes pi's cwd to the target path
  • Triggers session integration hooks (see Milestone 4)

Implementation Steps

  1. Validate input parameters
  2. Resolve target to a path (if it's a branch name, look up the worktree path)
  3. Check if already in that worktree — refuse if so
  4. Check for uncommitted changes in target — fail fast with message if switching away from it
  5. Change pi's cwd to the target path
  6. Trigger session integration hooks

Error Handling

  • Already there: "Already in this worktree."
  • Uncommitted changes in source: "Worktree '' has uncommitted changes. Stash them first?"
  • Target not found: "No worktree found at ''. Run 'git_worktree_list' to see available worktrees."

Validation

  • Switch to an existing worktree — verify cwd changes and branch display updates
  • Try to switch to non-existent target — should refuse with clear error
  • Verify session integration hooks fire after successful switch (Milestone 4)
# Overview Implement `git_worktree_switch` tool that switches pi's working directory to a linked worktree. ## Acceptance Criteria - [ ] Validates input parameters (target path or branch name) - [ ] Resolves target to a path (if it's a branch name, look up the worktree path) - [ ] Refuses if already in that worktree: "Already in this worktree." - [ ] Fails fast with message about uncommitted changes - [ ] Changes pi's cwd to the target path - [ ] Triggers session integration hooks (see Milestone 4) ## Implementation Steps 1. Validate input parameters 2. Resolve target to a path (if it's a branch name, look up the worktree path) 3. Check if already in that worktree — refuse if so 4. Check for uncommitted changes in target — fail fast with message if switching away from it 5. Change pi's cwd to the target path 6. Trigger session integration hooks ## Error Handling - Already there: "Already in this worktree." - Uncommitted changes in source: "Worktree '<path>' has uncommitted changes. Stash them first?" - Target not found: "No worktree found at '<target>'. Run 'git_worktree_list' to see available worktrees." ## Validation - Switch to an existing worktree — verify cwd changes and branch display updates - Try to switch to non-existent target — should refuse with clear error - Verify session integration hooks fire after successful switch (Milestone 4)
david closed this issue 2026-07-25 02:21:20 +00:00
david reopened this issue 2026-07-25 02:21:47 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: david/pi-worktrees#6
No description provided.