Implements the /worktree slash command, allowing users to switch the
active session to a new isolated Git worktree without restarting the CLI.
Key changes:
- Added '/worktree' slash command with streamlined messaging.
- Updated 'Config' class to support runtime updates to the target directory.
- Introduced 'WorkingDirectoryChanged' event to notify UI and hooks of path changes.
- Added comprehensive tests and updated documentation.
Introduces a central Git worktree management system to enable isolated, parallel agent orchestration. This allows running multiple Gemini sessions on different branches within the same repository without file contention.
Key Features:
- Added 'WorktreeService' in @google/gemini-cli-core to manage creation, lifecycle, and cleanup of Git worktrees.
- Implemented smart cleanup logic that detects untracked files and new commits, automatically preserving worktrees with uncommitted work.
- Added '--worktree' (-w) flag to the CLI to launch sessions in fresh, isolated environments.
- Enhanced the session exit experience with detailed status messages and instructions for resuming work in preserved worktrees.