it2 Automation Cookbook

Real-world automation recipes for orchestrating terminal environments and multi-pane workflows using the it2 CLI.

Overview & Evidence Standard

The recipes below illustrate multi-step terminal orchestration patterns. Because they target environment-specific setups (such as dev servers, container logs, or remote SSH targets), they are formatted as illustrative fragments. Every it2 subcommand, flag, and environment variable used in these recipes has been verified against the installed it2 CLI build and current Cobra command definitions.


Recipe 1: Development Workspace Setup

Create a structured development tab with a code editor, local dev server, and split log view.

#!/usr/bin/env bash
# Illustrative Fragment: Development Workspace Setup
# Creates a multi-pane development workspace

# 1. Create a dedicated tab with a custom badge
TAB_ID=$(it2 tab create "Development" --badge "Dev" --format json | jq -r '.id')

# 2. Split current pane vertically for the primary terminal / editor
EDITOR_SESSION=$(it2 session split --vertical --quiet)
it2 session send-text "$EDITOR_SESSION" "code ."

# 3. Split right pane horizontally for dev server logs
SERVER_SESSION=$(it2 session split --horizontal --quiet)
it2 session send-text "$SERVER_SESSION" "npm run dev"

echo "Workspace initialized for tab: $TAB_ID"

Recipe 2: Multi-Pane Log Monitoring

Monitor multiple system or service logs side by side.

#!/usr/bin/env bash
# Illustrative Fragment: Multi-Pane Log Monitoring
# Sets up side-by-side log streams

# Create a monitoring tab
it2 tab create "Logs" --badge "Logs"

# Split top pane horizontally for background log tailing
LOG_SESSION=$(it2 session split --horizontal --quiet)
it2 session send-text "$LOG_SESSION" "tail -f /var/log/system.log"

# Use main session for active filtering or search
it2 session send-text "it2 text search 'error'"

Recipe 3: Multi-Session Task Dispatch

Send commands across multiple open sessions using structured output and iteration.

#!/usr/bin/env bash
# Illustrative Fragment: Multi-Session Task Dispatch
# Iterates over active sessions and queries prompt status

SESSIONS=$(it2 session list -q)

for sid in $SESSIONS; do
    echo "Querying prompt state for session $sid..."
    it2 prompt get "$sid" --format json 2>/dev/null || true
done