Documentation
¶
Overview ¶
Package it2 provides a Go client library and CLI for the iTerm2 API.
it2 enables programmatic control of iTerm2 sessions, tabs, and windows over the Unix socket and WebSocket APIs. It handles authentication automatically and supports plugins for extensible session enrichment.
CLI Installation ¶
go install github.com/tmc/it2/cmd/it2@latest
Library Usage ¶
The internal/client package provides the Go API (internal; use the CLI for external automation):
c := client.New("ws://localhost:1912")
if err := c.Connect(ctx); err != nil {
log.Fatal(err)
}
defer c.Close()
sessions, err := c.ListSessions(ctx)
if err != nil {
log.Fatal(err)
}
for _, s := range sessions {
fmt.Printf("%s %s\n", s.SessionID, s.WindowID)
}
err = c.SendText(ctx, sessions[0].SessionID, "echo hello\n")
Connection ¶
The client prefers the Unix socket at ~/Library/Application Support/iTerm2/private/socket and falls back to ws://localhost:1912.
See Also ¶
- CLI documentation: https://github.com/tmc/it2
- iTerm2 API: https://iterm2.com/documentation-api.html
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
gen-docs
command
|
|
|
it2
command
Command it2 provides comprehensive control over iTerm2 through its WebSocket API.
|
Command it2 provides comprehensive control over iTerm2 through its WebSocket API. |
|
it2-claude-code-hook
command
|
|
|
it2-session-badge
command
|
|
|
it2-session-snapshot
command
|
|
|
it2-session-snapshot-claude
command
|
|
|
it2-session-snapshot-filesystem
command
|
|
|
internal
|
|
|
cmd
Package cmd provides command implementations for the it2 CLI.
|
Package cmd provides command implementations for the it2 CLI. |
|
cmd/alert
Package alert provides iTerm2 alert and dialog commands.
|
Package alert provides iTerm2 alert and dialog commands. |
|
cmd/app
Package app provides commands for controlling the iTerm2 application.
|
Package app provides commands for controlling the iTerm2 application. |
|
cmd/auth
Package auth provides commands for iTerm2 API authentication.
|
Package auth provides commands for iTerm2 API authentication. |
|
cmd/color
Package color provides commands for managing iTerm2 colors and appearance.
|
Package color provides commands for managing iTerm2 colors and appearance. |
|
cmd/colorpreset
Package colorpreset provides commands for managing iTerm2 color presets.
|
Package colorpreset provides commands for managing iTerm2 color presets. |
|
cmd/control
Package control provides iTerm2 custom control management commands.
|
Package control provides iTerm2 custom control management commands. |
|
cmd/event
Package event provides commands for managing iTerm2 event subscriptions.
|
Package event provides commands for managing iTerm2 event subscriptions. |
|
cmd/filepanel
Package filepanel provides iTerm2 file panel dialog commands.
|
Package filepanel provides iTerm2 file panel dialog commands. |
|
cmd/focus
Package focus provides commands for managing focus in iTerm2.
|
Package focus provides commands for managing focus in iTerm2. |
|
cmd/job
Package job provides commands for job monitoring in iTerm2.
|
Package job provides commands for job monitoring in iTerm2. |
|
cmd/keyboard
Package keyboard provides commands for managing keyboard bindings in iTerm2.
|
Package keyboard provides commands for managing keyboard bindings in iTerm2. |
|
cmd/lifecycle
Package lifecycle provides iTerm2 session lifecycle management commands.
|
Package lifecycle provides iTerm2 session lifecycle management commands. |
|
cmd/notification
Package notification provides commands for iTerm2 notification system.
|
Package notification provides commands for iTerm2 notification system. |
|
cmd/preference
Package preference provides iTerm2 preference management commands.
|
Package preference provides iTerm2 preference management commands. |
|
cmd/profile
Package profile provides commands for iTerm2 profile management.
|
Package profile provides commands for iTerm2 profile management. |
|
cmd/prompt
Package prompt provides commands for managing prompts and command history in iTerm2 sessions using Shell Integration features.
|
Package prompt provides commands for managing prompts and command history in iTerm2 sessions using Shell Integration features. |
|
cmd/selection
Package selection provides commands for managing text selection in iTerm2.
|
Package selection provides commands for managing text selection in iTerm2. |
|
cmd/session
Package session provides commands for iTerm2 session management.
|
Package session provides commands for iTerm2 session management. |
|
cmd/shell
Package shell provides commands for shell state detection and prompt tracking in iTerm2 sessions using Shell Integration features.
|
Package shell provides commands for shell state detection and prompt tracking in iTerm2 sessions using Shell Integration features. |
|
cmd/shortcuts
Package shortcuts provides top-level convenience commands that wrap commonly used session commands.
|
Package shortcuts provides top-level convenience commands that wrap commonly used session commands. |
|
cmd/snippet
Package snippet provides text snippet storage and retrieval commands.
|
Package snippet provides text snippet storage and retrieval commands. |
|
cmd/tab
Package tab provides commands for iTerm2 tab management.
|
Package tab provides commands for iTerm2 tab management. |
|
cmd/text
Package text provides commands for text operations in iTerm2.
|
Package text provides commands for text operations in iTerm2. |
|
cmd/tool
Package tool provides direct access to built-in session plugins.
|
Package tool provides direct access to built-in session plugins. |
|
cmd/utility
Package utility provides iTerm2 utility and helper commands.
|
Package utility provides iTerm2 utility and helper commands. |
|
cmd/variable
Package variable provides commands for iTerm2 variable management.
|
Package variable provides commands for iTerm2 variable management. |
|
cmd/window
Package window provides commands for iTerm2 window management.
|
Package window provides commands for iTerm2 window management. |
|
cmdcore
Package cmdcore provides core command infrastructure for iTerm2 CLI operations.
|
Package cmdcore provides core command infrastructure for iTerm2 CLI operations. |
|
cmderr
Package cmderr provides standardized error handling for iTerm2 CLI commands.
|
Package cmderr provides standardized error handling for iTerm2 CLI commands. |
|
cmdutil
Package cmdutil provides command utilities for iTerm2 CLI operations
|
Package cmdutil provides command utilities for iTerm2 CLI operations |
|
hints
Package hints provides a system for showing helpful suggestions to users, particularly for multi-agent workflows where Claude sessions need to understand inter-session communication protocols.
|
Package hints provides a system for showing helpful suggestions to users, particularly for multi-agent workflows where Claude sessions need to understand inter-session communication protocols. |
|
iterm2settings
Package iterm2settings provides utilities for checking iTerm2 application state and settings.
|
Package iterm2settings provides utilities for checking iTerm2 application state and settings. |
|
jqutil
Package jqutil provides jq filtering utilities for JSON output.
|
Package jqutil provides jq filtering utilities for JSON output. |
|
plugins
Package plugins provides the plugin manifest schema and verification system.
|
Package plugins provides the plugin manifest schema and verification system. |
|
plugins/verify
Package verify implements reproducible build verification for it2 plugins.
|
Package verify implements reproducible build verification for it2 plugins. |
|
prime
Package prime provides the inter-session communication guidelines for multi-agent workflows.
|
Package prime provides the inter-session communication guidelines for multi-agent workflows. |
|
scope
Package scope provides session filtering based on scope settings.
|
Package scope provides session filtering based on scope settings. |
|
sessionid
Package sessionid provides utilities for managing iTerm2 session identifiers.
|
Package sessionid provides utilities for managing iTerm2 session identifiers. |
|
sessionstate
Package sessionstate provides agent-agnostic session state detection and analysis.
|
Package sessionstate provides agent-agnostic session state detection and analysis. |
|
sessionstate/agents/claude
Package claude provides Claude Code agent detection patterns.
|
Package claude provides Claude Code agent detection patterns. |
|
validate
Package validate provides validation functions for iTerm2 CLI command inputs.
|
Package validate provides validation functions for iTerm2 CLI command inputs. |
|
waitstable
Package waitstable provides utilities for detecting when a stream or buffer has stabilized (no changes for a configured duration).
|
Package waitstable provides utilities for detecting when a stream or buffer has stabilized (no changes for a configured duration). |
Click to show internal directories.
Click to hide internal directories.