Commit graph

1 commit

Author SHA1 Message Date
David Kong
39dd626f10 feat: implement git_worktree_switch tool (Issue #6)
- Add pi-worktree-switch.ts with pure functions:
  - validateSwitchInput: validates target is non-empty
  - resolveWorktreeTarget: resolves path or branch name to worktree path
  - isAlreadyInWorktree: checks if cwd matches target
- Wire up createSwitchWorktreeTool with full validation pipeline:
  1. Validate input parameters
  2. List worktrees and resolve target to path
  3. Refuse if already in target worktree
  4. Fail fast on uncommitted changes in source
  5. Change cwd via ctx.chdir()
  6. Return success with branch info
- Remove dead resolveWorktreeTarget from main module
- 21 unit tests, 103 total passing, 0 regressions
2026-07-25 12:30:38 +10:00