Documentation
¶
Index ¶
- Constants
- func GetGroupLevel(path string) int
- func GetStoragePath() (string, error)
- func GroupByProject(instances []*Instance) map[string][]*Instance
- type Group
- type GroupData
- type GroupTree
- func (t *GroupTree) AddSession(inst *Instance)
- func (t *GroupTree) CollapseGroup(path string)
- func (t *GroupTree) CreateGroup(name string) *Group
- func (t *GroupTree) CreateSubgroup(parentPath, name string) *Group
- func (t *GroupTree) DeleteGroup(path string) []*Instance
- func (t *GroupTree) ExpandGroup(path string)
- func (t *GroupTree) ExpandGroupWithParents(path string)
- func (t *GroupTree) Flatten() []Item
- func (t *GroupTree) GetAllInstances() []*Instance
- func (t *GroupTree) GetGroupNames() []string
- func (t *GroupTree) GetGroupPaths() []string
- func (t *GroupTree) GroupCount() int
- func (t *GroupTree) MoveGroupDown(path string)
- func (t *GroupTree) MoveGroupUp(path string)
- func (t *GroupTree) MoveSessionDown(inst *Instance)
- func (t *GroupTree) MoveSessionToGroup(inst *Instance, newGroupPath string)
- func (t *GroupTree) MoveSessionUp(inst *Instance)
- func (t *GroupTree) RemoveSession(inst *Instance)
- func (t *GroupTree) RenameGroup(oldPath, newName string)
- func (t *GroupTree) SessionCount() int
- func (t *GroupTree) SyncWithInstances(instances []*Instance)
- func (t *GroupTree) ToggleGroup(path string)
- type Instance
- func (i *Instance) Exists() bool
- func (i *Instance) GetTmuxSession() *tmux.Session
- func (i *Instance) HasUpdated() bool
- func (i *Instance) Kill() error
- func (i *Instance) Preview() (string, error)
- func (i *Instance) PreviewFull() (string, error)
- func (i *Instance) Start() error
- func (i *Instance) UpdateStatus() error
- type InstanceData
- type Item
- type ItemType
- type Status
- type Storage
- type StorageData
Constants ¶
const DefaultGroupName = "default"
DefaultGroupName is the name used for the default group where ungrouped sessions go
Variables ¶
This section is empty.
Functions ¶
func GetGroupLevel ¶
GetGroupLevel returns the nesting level of a group (0 for root, 1 for child, etc.)
func GetStoragePath ¶
GetStoragePath returns the path to the sessions.json file
func GroupByProject ¶
GroupByProject groups sessions by their parent project directory
Types ¶
type Group ¶
type Group struct {
Name string
Path string // Full path like "projects" or "projects/devops"
Expanded bool
Sessions []*Instance
Order int
}
Group represents a group of sessions
type GroupData ¶
type GroupData struct {
Name string `json:"name"`
Path string `json:"path"`
Expanded bool `json:"expanded"`
Order int `json:"order"`
}
GroupData represents serializable group data
type GroupTree ¶
type GroupTree struct {
Groups map[string]*Group // path -> group
GroupList []*Group // Ordered list of groups
Expanded map[string]bool // Collapsed state persistence
}
GroupTree manages hierarchical session organization
func NewGroupTree ¶
NewGroupTree creates a new group tree from instances
func NewGroupTreeWithGroups ¶
NewGroupTreeWithGroups creates a group tree from instances and stored group data
func (*GroupTree) AddSession ¶
AddSession adds a session to the appropriate group
func (*GroupTree) CollapseGroup ¶
CollapseGroup collapses a group
func (*GroupTree) CreateGroup ¶
CreateGroup creates a new empty group
func (*GroupTree) CreateSubgroup ¶
CreateSubgroup creates a new empty group under a parent group
func (*GroupTree) DeleteGroup ¶
DeleteGroup deletes a group, all its subgroups, and moves all sessions to default
func (*GroupTree) ExpandGroup ¶
ExpandGroup expands a group
func (*GroupTree) ExpandGroupWithParents ¶
ExpandGroupWithParents expands a group and all its parent groups This ensures the group and its contents are visible in the flattened view
func (*GroupTree) GetAllInstances ¶
GetAllInstances returns all instances in order
func (*GroupTree) GetGroupNames ¶
GetGroupNames returns all group names for selection
func (*GroupTree) GetGroupPaths ¶
GetGroupPaths returns all group paths for selection
func (*GroupTree) GroupCount ¶
GroupCount returns total group count
func (*GroupTree) MoveGroupDown ¶
MoveGroupDown moves a group down in the order (only within siblings at same level)
func (*GroupTree) MoveGroupUp ¶
MoveGroupUp moves a group up in the order (only within siblings at same level)
func (*GroupTree) MoveSessionDown ¶
MoveSessionDown moves a session down within its group
func (*GroupTree) MoveSessionToGroup ¶
MoveSessionToGroup moves a session to a different group
func (*GroupTree) MoveSessionUp ¶
MoveSessionUp moves a session up within its group
func (*GroupTree) RemoveSession ¶
RemoveSession removes a session from its group
func (*GroupTree) RenameGroup ¶
RenameGroup renames a group and updates all subgroups
func (*GroupTree) SessionCount ¶
SessionCount returns total session count
func (*GroupTree) SyncWithInstances ¶
SyncWithInstances updates the tree with a new set of instances while preserving existing group structure (including empty groups)
func (*GroupTree) ToggleGroup ¶
ToggleGroup toggles the expanded state of a group
type Instance ¶
type Instance struct {
ID string `json:"id"`
Title string `json:"title"`
ProjectPath string `json:"project_path"`
GroupPath string `json:"group_path"` // e.g., "projects/devops"
Command string `json:"command"`
Tool string `json:"tool"`
Status Status `json:"status"`
CreatedAt time.Time `json:"created_at"`
// contains filtered or unexported fields
}
Instance represents a single agent/shell session
func DiscoverExistingTmuxSessions ¶
DiscoverExistingTmuxSessions finds all tmux sessions and converts them to instances
func FilterByQuery ¶
FilterByQuery filters sessions by title, project path, or tool
func NewInstance ¶
NewInstance creates a new session instance
func NewInstanceWithGroup ¶
NewInstanceWithGroup creates a new session instance with explicit group
func (*Instance) GetTmuxSession ¶
GetTmuxSession returns the tmux session object
func (*Instance) HasUpdated ¶
HasUpdated checks if there's new output since last check
func (*Instance) PreviewFull ¶
PreviewFull returns all terminal output
func (*Instance) UpdateStatus ¶
UpdateStatus updates the session status by checking tmux
type InstanceData ¶
type InstanceData struct {
ID string `json:"id"`
Title string `json:"title"`
ProjectPath string `json:"project_path"`
GroupPath string `json:"group_path"`
Command string `json:"command"`
Tool string `json:"tool"`
Status Status `json:"status"`
CreatedAt time.Time `json:"created_at"`
TmuxSession string `json:"tmux_session"`
}
InstanceData represents the serializable session data
type Item ¶
type Item struct {
Type ItemType
Group *Group
Session *Instance
Level int // Indentation level (0 for root groups, 1 for sessions)
Path string // Group path for this item
}
Item represents a single item in the flattened group tree view
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage handles persistence of session data Thread-safe with mutex protection for concurrent access
func (*Storage) LoadWithGroups ¶
LoadWithGroups reads instances and groups from JSON file Automatically recovers from backup if main file is corrupted
func (*Storage) Save ¶
Save persists instances to JSON file DEPRECATED: Use SaveWithGroups to ensure groups are not lost
func (*Storage) SaveWithGroups ¶
SaveWithGroups persists instances and groups to JSON file Uses atomic write pattern with: - Mutex for thread safety - Rolling backups (3 generations) - fsync for durability - Data validation
type StorageData ¶
type StorageData struct {
Instances []*InstanceData `json:"instances"`
Groups []*GroupData `json:"groups,omitempty"` // Persist empty groups
UpdatedAt time.Time `json:"updated_at"`
}
StorageData represents the JSON structure for persistence