Google Gemini CLI Automation with it2

it2 allows you to manage and drive Google Gemini CLI (@google/gemini-cli) sessions in dedicated iTerm2 panes.

Overview

By running Gemini CLI inside it2-managed split panes, you gain:

  • Spatial Isolation: Run Gemini CLI in a side-by-side split next to your code editor or build terminal.
  • Session Identification: Label sessions using it2 session badge set and it2 session title set.
  • Programmatic Control: Send prompts or start interactive sessions programmatically.

Quick Start

Launch an interactive Gemini CLI session in a dedicated split pane:

#!/usr/bin/env bash
# Illustrative Fragment: Launch Gemini CLI in a split pane

# 1. Create a vertical split pane
SESSION_ID=$(it2 session split --vertical --quiet)

# 2. Set a badge on the new session
it2 session badge set "Gemini" "$SESSION_ID"

# 3. Launch Gemini CLI in the pane
it2 session send-text "$SESSION_ID" "gemini"

Non-Interactive Automation

Run a single prompt and capture results using it2 CLI:

#!/usr/bin/env bash
# Illustrative Fragment: One-shot non-interactive query

SESSION_ID=$(it2 session split --horizontal --quiet)
it2 session send-text "$SESSION_ID" "gemini -p 'Explain code architecture' > architecture.md"