Documentation
¶
Index ¶
- func AllocatePortsLegacy() (fePort, apiPort int, err error)
- func AttachEditorToSession(sessionName, path string) error
- func AttachTmuxSession(sessionName string) error
- func BranchExists(repoPath, branchName string) (bool, error)
- func ClearAttentionFlag(sessionName string) error
- func ClearRegistry() error
- func CopyBootstrapFiles(projectRoot, worktreePath string) error
- func CreateWorktree(repoPath, name string, detach bool) error
- func GenerateEnvrc(worktreePath string, data EnvrcData) error
- func GenerateTmuxpConfig(worktreePath string, data TmuxpData) error
- func GetCurrentSessionName() string
- func GetEditorCommand() string
- func GetProjectRoot() (string, error)
- func IsEditorAvailable() bool
- func IsProcessRunning(pid int) bool
- func IsTmuxRunning() bool
- func IsWorktreeCheckedOut(repoPath, branchName string) (bool, string, error)
- func LaunchEditor(path string) (int, error)
- func LaunchEditorForSession(sessionName, path string) error
- func LaunchTmuxSession(worktreePath, sessionName string) error
- func PruneWorktrees(repoPath string) error
- func PullFromOrigin(repoPath, branch string) error
- func RemoveSession(name string, sess *Session) error
- func RunCleanupCommand(sess *Session) error
- func RunCleanupCommandForShell(sess *Session) error
- func SetAttentionFlag(sessionName, reason string) error
- func TerminateEditor(sessionName string) error
- func ValidatePort(port int) error
- func WorktreeExists(repoPath, worktreePath string) (bool, error)
- type EnvrcData
- type PortAllocation
- type Session
- type SessionStore
- func (s *SessionStore) AddSession(name, branch, path string, ports map[string]int) error
- func (s *SessionStore) AddSessionWithProject(name, branch, path string, ports map[string]int, ...) error
- func (s *SessionStore) GetSession(name string) (*Session, bool)
- func (s *SessionStore) RemoveSession(name string) error
- func (s *SessionStore) Save() error
- func (s *SessionStore) UpdateSession(name string, updateFn func(*Session)) error
- type TmuxpData
- type WorktreeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllocatePortsLegacy ¶
AllocatePortsLegacy allocates two unique ports for frontend and API (backwards compatibility)
func AttachEditorToSession ¶
AttachEditorToSession handles editor attachment logic for session attach
func AttachTmuxSession ¶
AttachTmuxSession attaches to an existing tmux session
func BranchExists ¶
BranchExists checks if a branch exists in the repository
func ClearAttentionFlag ¶
ClearAttentionFlag clears the attention flag for a session
func ClearRegistry ¶
func ClearRegistry() error
ClearRegistry removes all sessions and clears the sessions file
func CopyBootstrapFiles ¶
CopyBootstrapFiles copies configured bootstrap files from project root to the worktree
func CreateWorktree ¶
CreateWorktree creates a new git worktree
func GenerateEnvrc ¶
GenerateEnvrc creates an .envrc file in the worktree directory
func GenerateTmuxpConfig ¶
GenerateTmuxpConfig creates a .tmuxp.yaml file in the worktree directory
func GetCurrentSessionName ¶
func GetCurrentSessionName() string
GetCurrentSessionName attempts to determine the current session based on working directory
func GetEditorCommand ¶
func GetEditorCommand() string
GetEditorCommand returns the editor command to use, checking in this order: 1. devx config "editor" setting 2. VISUAL environment variable 3. EDITOR environment variable 4. Empty string if none are set
func GetProjectRoot ¶
GetProjectRoot finds the git repository root directory
func IsEditorAvailable ¶
func IsEditorAvailable() bool
IsEditorAvailable checks if the configured editor command is available
func IsProcessRunning ¶
IsProcessRunning checks if a process with the given PID is still running
func IsTmuxRunning ¶
func IsTmuxRunning() bool
IsTmuxRunning checks if we're already inside a tmux session
func IsWorktreeCheckedOut ¶
IsWorktreeCheckedOut checks if a branch is already checked out in a worktree
func LaunchEditor ¶
LaunchEditor launches the configured editor with the given path It runs asynchronously and returns the process PID
func LaunchEditorForSession ¶
LaunchEditorForSession launches the editor for a session and updates the session metadata
func LaunchTmuxSession ¶
LaunchTmuxSession launches a tmux session using tmuxp
func PruneWorktrees ¶
PruneWorktrees removes stale worktree references
func PullFromOrigin ¶
PullFromOrigin pulls the latest changes from origin for the specified branch
func RemoveSession ¶
RemoveSession removes a single session completely (helper for commands)
func RunCleanupCommand ¶
RunCleanupCommand executes the configured cleanup command with session environment variables
func RunCleanupCommandForShell ¶
RunCleanupCommandForShell executes cleanup command through shell for complex commands
func SetAttentionFlag ¶
SetAttentionFlag sets the attention flag for a session
func TerminateEditor ¶
TerminateEditor terminates the editor process for a session
func WorktreeExists ¶
WorktreeExists checks if a worktree exists at the specified path
Types ¶
type PortAllocation ¶
PortAllocation represents allocated ports with their service names
func AllocatePorts ¶
func AllocatePorts(serviceNames []string) (*PortAllocation, error)
AllocatePorts allocates unique ports for the given service names
type Session ¶
type Session struct {
Name string `json:"name"`
ProjectAlias string `json:"project_alias,omitempty"` // Reference to project in registry
ProjectPath string `json:"project_path,omitempty"` // Resolved project path
Branch string `json:"branch"`
Path string `json:"path"`
Ports map[string]int `json:"ports"`
Routes map[string]string `json:"routes,omitempty"` // service -> route ID mapping
EditorPID int `json:"editor_pid,omitempty"` // PID of the editor process
AttentionFlag bool `json:"attention_flag,omitempty"`
AttentionReason string `json:"attention_reason,omitempty"` // "claude_done", "claude_stuck", "manual", etc.
AttentionTime time.Time `json:"attention_time,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type SessionStore ¶
func LoadRegistry ¶
func LoadRegistry() (*SessionStore, error)
LoadRegistry is an alias for LoadSessions for compatibility
func LoadSessions ¶
func LoadSessions() (*SessionStore, error)
LoadSessions loads the sessions from the metadata file
func (*SessionStore) AddSession ¶
func (s *SessionStore) AddSession(name, branch, path string, ports map[string]int) error
AddSession adds a new session to the store
func (*SessionStore) AddSessionWithProject ¶
func (s *SessionStore) AddSessionWithProject(name, branch, path string, ports map[string]int, projectAlias, projectPath string) error
AddSessionWithProject adds a new session to the store with project information
func (*SessionStore) GetSession ¶
func (s *SessionStore) GetSession(name string) (*Session, bool)
GetSession retrieves a session by name
func (*SessionStore) RemoveSession ¶
func (s *SessionStore) RemoveSession(name string) error
RemoveSession removes a session from the store
func (*SessionStore) Save ¶
func (s *SessionStore) Save() error
SaveSessions saves the sessions to the metadata file
func (*SessionStore) UpdateSession ¶
func (s *SessionStore) UpdateSession(name string, updateFn func(*Session)) error
UpdateSession updates an existing session
type WorktreeInfo ¶
func ListWorktrees ¶
func ListWorktrees(repoPath string) ([]WorktreeInfo, error)
ListWorktrees returns all git worktrees in the repository