Documentation
¶
Overview ¶
Package session provides commands for iTerm2 session management.
Sessions in iTerm2 represent individual terminal instances within tabs. This package provides commands to:
- list: List all active sessions with details
- create: Create new sessions in existing or new tabs
- close: Terminate sessions gracefully
- activate: Switch focus to specific sessions
- restart: Restart terminated sessions
- split: Split sessions into multiple panes
Session operations work with session IDs that uniquely identify each terminal instance. These IDs can be obtained from the list command and are used as arguments for most session operations. The list command omits buried sessions by default; use --include-buried to show them.
Examples:
it2 session list it2 session create --profile "Development" it2 session split w0t0p0s0 --direction horizontal it2 session close w0t0p0s0
Index ¶
- func LoadSessionTags(sessionID string) (map[string]string, error)
- func NewBadgeCommand() *cobra.Command
- func NewCommand() *cobra.Command
- func NewLookupCommand() *cobra.Command
- func NewProcessCommand() *cobra.Command
- func NewProfileCommand() *cobra.Command
- func NewTitleCommand() *cobra.Command
- func NewVariableCommand() *cobra.Command
- type AutoResponder
- type ClaudeInfo
- type DeliveryResult
- type ESLogsInfo
- type SessionExport
- type SessionNode
- type StateTransition
- type TemplateData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadSessionTags ¶
LoadSessionTags loads tags for a session from persistent storage. This is exported for use by other commands like get-info and export.
func NewBadgeCommand ¶
NewBadgeCommand creates the badge subcommand group
func NewCommand ¶
NewCommand creates the session command with all subcommands.
func NewLookupCommand ¶
NewLookupCommand creates the session lookup command with subcommands.
func NewProcessCommand ¶
NewProcessCommand creates the process subcommand group
func NewProfileCommand ¶
NewProfileCommand creates the session profile command with all subcommands.
func NewTitleCommand ¶
NewTitleCommand creates the title subcommand group
func NewVariableCommand ¶
NewVariableCommand creates the variable subcommand group
Types ¶
type AutoResponder ¶
type AutoResponder struct {
Pattern *regexp.Regexp
Response string
Action string // "text", "key", "ctrl-o", "todos"
Cooldown time.Duration
LastUsed time.Time
}
AutoResponder holds patterns and responses for automatic interaction
type ClaudeInfo ¶
type ClaudeInfo struct {
ITerm2SessionID string `json:"iterm2_session_id"`
ClaudeSessionID string `json:"claude_session_id,omitempty"`
TranscriptPath string `json:"transcript_path,omitempty"`
LastEvent string `json:"last_event,omitempty"`
HasClaudeSession bool `json:"has_claude_session"`
}
ClaudeInfo contains Claude Code session information linked to an iTerm2 session.
type DeliveryResult ¶
type DeliveryResult struct {
Status string `json:"status"`
Message string `json:"message"`
ExitCode int `json:"exit_code"`
Delivered bool `json:"delivered"`
}
DeliveryResult represents the result of text delivery confirmation
type ESLogsInfo ¶
type ESLogsInfo struct {
Available bool `json:"available"`
EventCount int64 `json:"event_count,omitempty"`
ExecCount int64 `json:"exec_count,omitempty"`
FileOps int64 `json:"file_ops,omitempty"`
FirstEvent *time.Time `json:"first_event,omitempty"`
LastEvent *time.Time `json:"last_event,omitempty"`
Agent string `json:"agent,omitempty"`
}
ESLogsInfo contains eslogs data for the session.
type SessionExport ¶
type SessionExport struct {
SessionID string `json:"session_id"`
ShortID string `json:"short_id"`
StartTime *time.Time `json:"start_time,omitempty"`
EndTime *time.Time `json:"end_time,omitempty"`
WorkingDirs []string `json:"working_directories,omitempty"`
CurrentDir string `json:"current_directory,omitempty"`
ShellPID int32 `json:"shell_pid,omitempty"`
JobPID int32 `json:"job_pid,omitempty"`
Process string `json:"process,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
ESLogs *ESLogsInfo `json:"eslogs,omitempty"`
}
SessionExport represents exported session metadata for forensic correlation.
type SessionNode ¶
type SessionNode struct {
SessionID string
ShortID string
Name string
ParentID string
Children []*SessionNode
IsActive bool
IsCurrent bool
}
SessionNode represents a session in the hierarchy
type StateTransition ¶
type StateTransition struct {
Timestamp time.Time `json:"timestamp"`
SessionID string `json:"session_id"`
State sessionstate.State `json:"state"`
PreviousState sessionstate.State `json:"previous_state"`
TriggerEvent string `json:"trigger_event"`
ModalType sessionstate.ModalType `json:"modal_type,omitempty"`
Safe bool `json:"safe,omitempty"`
Action sessionstate.SuggestedAction `json:"action,omitempty"`
ActionTaken bool `json:"action_taken,omitempty"`
}
StateTransition represents a state change event
type TemplateData ¶
type TemplateData struct {
Content string // The text content to send
SessionID string // Full session ID
ShortID string // Shortened session ID (last 8 chars)
Timestamp string // Current timestamp in RFC3339 format
}
TemplateData represents the data available in send-text templates
Source Files
¶
- doc.go
- get_screen_wait.go
- session.go
- session_activate.go
- session_artifacts.go
- session_autorespond.go
- session_badge.go
- session_bury.go
- session_claude.go
- session_claude_status.go
- session_clear_badge.go
- session_clear_title.go
- session_clear_variable.go
- session_close.go
- session_copy.go
- session_create.go
- session_current.go
- session_export.go
- session_export_recording.go
- session_focus.go
- session_focused.go
- session_get_badge.go
- session_get_buffer.go
- session_get_info.go
- session_get_pid.go
- session_get_property.go
- session_get_screen.go
- session_get_state.go
- session_get_title.go
- session_get_variable.go
- session_has_modal.go
- session_has_process.go
- session_has_shell_integration.go
- session_is_active.go
- session_list.go
- session_list_variables.go
- session_lookup.go
- session_lookup_above.go
- session_lookup_after.go
- session_lookup_ancestors.go
- session_lookup_before.go
- session_lookup_by_pid.go
- session_lookup_children.go
- session_lookup_descendants.go
- session_lookup_lineage.go
- session_lookup_parent.go
- session_lookup_siblings.go
- session_lookup_split_root.go
- session_lookup_tab.go
- session_lookup_window.go
- session_monitor.go
- session_move.go
- session_parent.go
- session_paste.go
- session_process.go
- session_process_list.go
- session_profile.go
- session_profile_get.go
- session_profile_list.go
- session_profile_reset.go
- session_profile_set.go
- session_prompt.go
- session_resize.go
- session_restart.go
- session_run.go
- session_select.go
- session_send_key.go
- session_send_text.go
- session_set_badge.go
- session_set_property.go
- session_set_title.go
- session_set_variable.go
- session_split.go
- session_splits.go
- session_splits_alias.go
- session_subscribe.go
- session_suggest_action.go
- session_tag.go
- session_tail.go
- session_title.go
- session_variable.go
- session_watch.go