# danitrap/sesh architecture

> Architecture diagram of the GitHub repository danitrap/sesh, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danitrap/sesh
- Repository: https://github.com/danitrap/sesh

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Core Components:
- Session Manager (Central Controller)
- Connectors (tmux, tmuxinator, zoxide)
- Configuration Manager
- CLI Interface

b) Supporting Components:
- File System Interface
- Process Execution Layer
- Directory Management
- Git Integration

##### Component Relationships

**CLI Interface (seshcli)**
- ↓
**Session Manager**
- ↓
- Connectors Layer
- TMux Connector
- Tmuxinator Connector
- Zoxide Connector

- Configuration Layer
- Config Parser (TOML)
- Default Settings

- Utility Layer
- File System Operations
- Git Operations
- Directory Management
- Process Execution

##### Implementation Details

a) Data Flow:
- Command input through CLI
- Session management operations
- Integration with external tools
- Configuration reading/writing

b) Key Interfaces:
- Cloner interface
- Connector interface
- Lister interface
- Shell interface

##### Architecture Patterns

- Interface-based design (shown by multiple mock implementations)
- Dependency injection (visible in the component structure)
- Command pattern (in CLI implementation)
- Strategy pattern (in session management)

**┌─ User Interface Layer ─┐**
- CLI Commands        │
- Interactive Mode    │
- ┬────────────┘
- ↓
**┌─ Core Services Layer ─┐**
- Session Management │
- Directory Handling │
- Git Integration    │
- ┬────────────┘
- ↓
**┌─ Integration Layer ──┐**
- TMux             │
- Tmuxinator       │
- Zoxide          │
- ┘

##### Additional Notes

- Notes for important configuration points
- Error handling paths
- Async operations where applicable

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        CLI["CLI Interface"]:::cli
        CLI_Connect["Connect Command"]:::cli
        CLI_List["List Command"]:::cli
        CLI_Root["Root Command"]:::cli
        
        CLI --> CLI_Connect
        CLI --> CLI_List
        CLI --> CLI_Root
    end

    subgraph Core["Core Services Layer"]
        SeshMgr["Session Manager"]:::core
        ConfigMgr["Configuration Manager"]:::config
        DirMgr["Directory Manager"]:::core
        GitMgr["Git Operations"]:::core
        
        ConfigParser["Config Parser (TOML)"]:::config
        DefaultConfig["Default Settings"]:::config
        
        ConfigMgr --> ConfigParser
        ConfigMgr --> DefaultConfig
    end

    subgraph Integration["Integration Layer"]
        ConnectorInterface["Connector Interface"]:::interface
        
        TMuxCon["TMux Connector"]:::connector
        TmuxinatorCon["Tmuxinator Connector"]:::connector
        ZoxideCon["Zoxide Connector"]:::connector
        
        ConnectorInterface --> TMuxCon
        ConnectorInterface --> TmuxinatorCon
        ConnectorInterface --> ZoxideCon
    end

    subgraph Utility["Utility Layer"]
        FSOps["File System Operations"]:::util
        ProcExec["Process Execution"]:::util
        PathMgr["Path Management"]:::util
        Shell["Shell Interface"]:::interface
        Cloner["Cloner Interface"]:::interface
        Lister["Lister Interface"]:::interface
    end

    CLI --> SeshMgr
    SeshMgr --> ConnectorInterface
    SeshMgr --> ConfigMgr
    SeshMgr --> DirMgr
    SeshMgr --> GitMgr
    
    DirMgr --> FSOps
    GitMgr --> ProcExec
    ConnectorInterface --> Shell
    ConnectorInterface --> Cloner
    ConnectorInterface --> Lister

    %% Component Mappings
    click CLI "https://github.com/danitrap/sesh/tree/main/seshcli"
    click CLI_Connect "https://github.com/danitrap/sesh/blob/main/seshcli/connect.go"
    click CLI_List "https://github.com/danitrap/sesh/blob/main/seshcli/list.go"
    click CLI_Root "https://github.com/danitrap/sesh/blob/main/seshcli/root.go"
    click ConnectorInterface "https://github.com/danitrap/sesh/blob/main/connector/connector.go"
    click TMuxCon "https://github.com/danitrap/sesh/blob/main/tmux/tmux.go"
    click TmuxinatorCon "https://github.com/danitrap/sesh/blob/main/tmuxinator/tmuxinator.go"
    click ZoxideCon "https://github.com/danitrap/sesh/blob/main/zoxide/zoxide.go"
    click ConfigMgr "https://github.com/danitrap/sesh/blob/main/configurator/configurator.go"
    click DefaultConfig "https://github.com/danitrap/sesh/blob/main/startup/defaultconfig.go"
    click FSOps "https://github.com/danitrap/sesh/blob/main/oswrap/oswrap.go"
    click ProcExec "https://github.com/danitrap/sesh/blob/main/execwrap/execwrap.go"
    click DirMgr "https://github.com/danitrap/sesh/blob/main/dir/dir.go"
    click GitMgr "https://github.com/danitrap/sesh/blob/main/git/git.go"
    click PathMgr "https://github.com/danitrap/sesh/blob/main/pathwrap/pathwrap.go"
    click Shell "https://github.com/danitrap/sesh/blob/main/shell/shell.go"
    click Cloner "https://github.com/danitrap/sesh/blob/main/cloner/cloner.go"
    click Lister "https://github.com/danitrap/sesh/blob/main/lister/lister.go"

    classDef core fill:#2374ab
    classDef cli fill:#48cae4
    classDef config fill:#ffa62b
    classDef connector fill:#16db93
    classDef interface fill:#9d4edd
    classDef util fill:#89b0ae
    
    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["CLI Components"]:::cli
        L3["Configuration"]:::config
        L4["Connectors"]:::connector
        L5["Interfaces"]:::interface
        L6["Utilities"]:::util
    end
```
