Extract git functions and add integration tests

Move git operations (listGitBranches, checkoutGitBranch, createGitWorktree,
etc.) from main.ts into git.ts for testability. Add 20 integration tests
that run real git commands against temporary repos covering checkout,
branch creation, worktrees, conflicts, and thread-switching flows.

Also fix: branch checkout now runs regardless of envMode, worktree
creation passes cwd to ensureSession to avoid stale closure bug, and
current branch auto-fills on new threads.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f47dc3c78cJulius Marminge committed on 2/11/2026, 5:00:18 PMparente9cfe37
3 files changedLine totals unavailable