session

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 35 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSessionTags

func LoadSessionTags(sessionID string) (map[string]string, error)

LoadSessionTags loads tags for a session from persistent storage. This is exported for use by other commands like get-info and export.

func NewBadgeCommand

func NewBadgeCommand() *cobra.Command

NewBadgeCommand creates the badge subcommand group

func NewCommand

func NewCommand() *cobra.Command

NewCommand creates the session command with all subcommands.

func NewLookupCommand

func NewLookupCommand() *cobra.Command

NewLookupCommand creates the session lookup command with subcommands.

func NewProcessCommand

func NewProcessCommand() *cobra.Command

NewProcessCommand creates the process subcommand group

func NewProfileCommand

func NewProfileCommand() *cobra.Command

NewProfileCommand creates the session profile command with all subcommands.

func NewTitleCommand

func NewTitleCommand() *cobra.Command

NewTitleCommand creates the title subcommand group

func NewVariableCommand

func NewVariableCommand() *cobra.Command

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL