Documentation
¶
Overview ¶
Package webui provides git operation handlers
Package webui provides history and rollback operation handlers ¶
Package webui provides React web server with embedded assets
Index ¶
- func CheckPortAvailable(port int) bool
- func FindAvailablePort(basePort int) int
- type ChangelogEntry
- type ConnectionInfo
- type FileRevision
- type GitFile
- type GitStatus
- type ReactWebServer
- type SafeConn
- type TerminalManager
- func (tm *TerminalManager) AddToHistory(sessionID, command string) error
- func (tm *TerminalManager) CleanupInactiveSessions(timeout time.Duration)
- func (tm *TerminalManager) CloseSession(sessionID string) error
- func (tm *TerminalManager) CreateSession(sessionID string) (*TerminalSession, error)
- func (tm *TerminalManager) ExecuteCommand(sessionID, command string) error
- func (tm *TerminalManager) GetHistory(sessionID string) ([]string, error)
- func (tm *TerminalManager) GetSession(sessionID string) (*TerminalSession, bool)
- func (tm *TerminalManager) GetSessionCount() int
- func (tm *TerminalManager) GetTerminalSize(sessionID string) (*pty.Winsize, error)
- func (tm *TerminalManager) ListSessions() []string
- func (tm *TerminalManager) NavigateHistory(sessionID string, direction string) (string, error)
- func (tm *TerminalManager) ResetHistoryIndex(sessionID string) error
- func (tm *TerminalManager) ResizeTerminal(sessionID string, rows, cols uint16) error
- func (tm *TerminalManager) SessionCount() int
- func (tm *TerminalManager) StartCleanupWorker(ctx context.Context, interval time.Duration, timeout time.Duration)
- type TerminalSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPortAvailable ¶ added in v0.9.3
CheckPortAvailable checks if a port is available to bind to
func FindAvailablePort ¶ added in v0.9.3
FindAvailablePort finds an available port starting from a base port
Types ¶
type ChangelogEntry ¶ added in v0.10.5
type ChangelogEntry struct {
RevisionID string `json:"revision_id"`
Timestamp string `json:"timestamp"`
Files []FileRevision `json:"files"`
Description string `json:"description"`
}
ChangelogEntry represents a changelog entry
type ConnectionInfo ¶ added in v0.9.3
type ConnectionInfo struct {
SessionID string // Unique session ID for this connection
Type string // "webui" or "terminal"
ConnectedAt time.Time // When the connection was established
}
ConnectionInfo stores metadata about a WebSocket connection
type FileRevision ¶ added in v0.10.5
type FileRevision struct {
Path string `json:"path"`
Operation string `json:"operation"`
LinesAdded int `json:"lines_added"`
LinesDeleted int `json:"lines_deleted"`
}
FileRevision represents a file revision
type GitFile ¶ added in v0.9.3
type GitFile struct {
Path string `json:"path"`
Status string `json:"status"`
Staged bool `json:"staged,omitempty"`
}
GitFile represents a file with its git status
type GitStatus ¶ added in v0.9.3
type GitStatus struct {
Branch string `json:"branch"`
Ahead int `json:"ahead"`
Behind int `json:"behind"`
Staged []GitFile `json:"staged"`
Modified []GitFile `json:"modified"`
Untracked []GitFile `json:"untracked"`
Deleted []GitFile `json:"deleted"`
Renamed []GitFile `json:"renamed"`
}
GitStatus represents the git status response
type ReactWebServer ¶
type ReactWebServer struct {
// contains filtered or unexported fields
}
ReactWebServer provides the React web UI
func NewReactWebServer ¶
NewReactWebServer creates a new React web server
func (*ReactWebServer) GetPort ¶
func (ws *ReactWebServer) GetPort() int
GetPort returns the port the web server is running on
func (*ReactWebServer) IsRunning ¶
func (ws *ReactWebServer) IsRunning() bool
IsRunning returns true if the web server is running
func (*ReactWebServer) Shutdown ¶
func (ws *ReactWebServer) Shutdown() error
Shutdown gracefully shuts down the web server
type SafeConn ¶ added in v0.9.3
type SafeConn struct {
// contains filtered or unexported fields
}
SafeConn wraps a WebSocket connection with write mutex and panic recovery
func NewSafeConn ¶ added in v0.9.3
NewSafeConn creates a new safe connection wrapper
func (*SafeConn) Underlying ¶ added in v0.9.3
Underlying returns the underlying websocket.Conn for read operations (still need to be careful)
type TerminalManager ¶
type TerminalManager struct {
// contains filtered or unexported fields
}
TerminalManager manages terminal sessions
func NewTerminalManager ¶
func NewTerminalManager() *TerminalManager
NewTerminalManager creates a new terminal manager
func (*TerminalManager) AddToHistory ¶
func (tm *TerminalManager) AddToHistory(sessionID, command string) error
AddToHistory adds a command to the session history
func (*TerminalManager) CleanupInactiveSessions ¶
func (tm *TerminalManager) CleanupInactiveSessions(timeout time.Duration)
CleanupInactiveSessions removes sessions that have been inactive for too long
func (*TerminalManager) CloseSession ¶
func (tm *TerminalManager) CloseSession(sessionID string) error
CloseSession closes a terminal session
func (*TerminalManager) CreateSession ¶
func (tm *TerminalManager) CreateSession(sessionID string) (*TerminalSession, error)
CreateSession creates a new terminal session with PTY support
func (*TerminalManager) ExecuteCommand ¶
func (tm *TerminalManager) ExecuteCommand(sessionID, command string) error
ExecuteCommand executes a command in the specified session
func (*TerminalManager) GetHistory ¶
func (tm *TerminalManager) GetHistory(sessionID string) ([]string, error)
GetHistory returns the command history for a session
func (*TerminalManager) GetSession ¶
func (tm *TerminalManager) GetSession(sessionID string) (*TerminalSession, bool)
GetSession retrieves a terminal session
func (*TerminalManager) GetSessionCount ¶
func (tm *TerminalManager) GetSessionCount() int
GetSessionCount returns the number of active sessions
func (*TerminalManager) GetTerminalSize ¶
func (tm *TerminalManager) GetTerminalSize(sessionID string) (*pty.Winsize, error)
GetTerminalSize returns the current terminal size for the session
func (*TerminalManager) ListSessions ¶
func (tm *TerminalManager) ListSessions() []string
ListSessions returns a list of active session IDs
func (*TerminalManager) NavigateHistory ¶
func (tm *TerminalManager) NavigateHistory(sessionID string, direction string) (string, error)
NavigateHistory navigates through command history
func (*TerminalManager) ResetHistoryIndex ¶
func (tm *TerminalManager) ResetHistoryIndex(sessionID string) error
ResetHistoryIndex resets the history index to the end (for new input)
func (*TerminalManager) ResizeTerminal ¶
func (tm *TerminalManager) ResizeTerminal(sessionID string, rows, cols uint16) error
ResizeTerminal resizes the terminal for the given session
func (*TerminalManager) SessionCount ¶
func (tm *TerminalManager) SessionCount() int
SessionCount returns the number of active sessions (alias for GetSessionCount)
func (*TerminalManager) StartCleanupWorker ¶
func (tm *TerminalManager) StartCleanupWorker(ctx context.Context, interval time.Duration, timeout time.Duration)
StartCleanupWorker starts a background worker to clean up inactive sessions
type TerminalSession ¶
type TerminalSession struct {
ID string
Command *exec.Cmd
Pty *os.File // PTY file handle
Output io.Reader // PTY handles both input and output
Cancel context.CancelFunc
Active bool
LastUsed time.Time
History []string
HistoryIndex int
OutputCh chan []byte
Size *pty.Winsize // Terminal size for resizing
// contains filtered or unexported fields
}
TerminalSession represents a terminal session