Documentation
¶
Index ¶
- func NewHTTP(d deps.Deps) *http.ServeMux
- type ClaudeMDConfig
- type ClaudeMDConfigListResponse
- type ClaudeMDCreateRequest
- type ClaudeMDUpdateRequest
- type ClaudeMessage
- type ClaudeService
- func (cs *ClaudeService) CleanupSessionWorktree(sessionID, userID string) error
- func (cs *ClaudeService) CommitSessionChanges(sessionID, userID, commitMessage string) (string, error)
- func (cs *ClaudeService) CreateClaudeMDConfig(req *ClaudeMDCreateRequest) (*ClaudeMDConfig, error)
- func (cs *ClaudeService) CreateGitSessionWithPersistence(threadTS, channelID, userID, repoPath, baseBranch string) (*Process, *SessionInfo, *GitSessionInfo, error)
- func (cs *ClaudeService) CreateGitSessionWithPersistenceAndConfig(threadTS, channelID, userID, repoPath, baseBranch, configID string) (*Process, *SessionInfo, *GitSessionInfo, error)
- func (cs *ClaudeService) CreateSessionWithCallbackFix(threadTS, channelID, userID, workingDir string) (*ProcessWithCallback, *SessionInfo, error)
- func (cs *ClaudeService) CreateSessionWithDeferredDirectory(threadTS, channelID, userID, workingDir string) (*Process, *SessionInfo, error)
- func (cs *ClaudeService) CreateSessionWithPersistence(threadTS, channelID, userID, workingDir string) (*Process, *SessionInfo, error)
- func (cs *ClaudeService) CreateSessionWithPersistenceAndConfig(threadTS, channelID, userID, workingDir, configID string) (*Process, *SessionInfo, error)
- func (cs *ClaudeService) DeactivateSession(sessionID string) error
- func (cs *ClaudeService) DeleteClaudeMDConfig(id string) error
- func (cs *ClaudeService) DiagnoseSessionDirectories() error
- func (cs *ClaudeService) FixSessionIDMismatch(goSessionID, claudeSessionID string) error
- func (cs *ClaudeService) GetClaudeMDConfig(id string) (*ClaudeMDConfig, error)
- func (cs *ClaudeService) GetClaudeMDConfigByName(name string) (*ClaudeMDConfig, error)
- func (cs *ClaudeService) GetClaudeMDConfigContent(configName string) (string, error)
- func (cs *ClaudeService) GetDB() *gorm.DB
- func (cs *ClaudeService) GetSession(sessionID, userID string) (*models.ClaudeSession, error)
- func (cs *ClaudeService) GetSessionDiff(sessionID, userID string) (string, error)
- func (cs *ClaudeService) GetSessionGitStatus(sessionID, userID string) (*RepositoryStatus, error)
- func (cs *ClaudeService) GetSessionInfo(threadTS, userID string) (*SessionInfo, error)
- func (cs *ClaudeService) GetSessions(userID string) ([]models.ClaudeSession, error)
- func (cs *ClaudeService) HandleWebSocket(conn *websocket.Conn, userID string)
- func (cs *ClaudeService) InitializeClaudeMDConfigs() error
- func (cs *ClaudeService) ListClaudeMDConfigs() (*ClaudeMDConfigListResponse, error)
- func (cs *ClaudeService) ReceiveMessages(process *Process) <-chan Message
- func (cs *ClaudeService) ResumeSession(sessionID, userID string) (*Process, error)
- func (cs *ClaudeService) SendMessage(process *Process, text string) error
- func (cs *ClaudeService) StopSession(sessionID string)
- func (cs *ClaudeService) UpdateClaudeMDConfig(id string, req *ClaudeMDUpdateRequest) (*ClaudeMDConfig, error)
- func (cs *ClaudeService) UpdateSessionActivity(sessionID string) error
- func (cs *ClaudeService) UpdateSessionInfoWithClaudeID(sessionInfo *SessionInfo, claudeSessionID string) error
- func (cs *ClaudeService) ValidateSessionConsistency(goSessionID, claudeSessionID string) error
- type CommitInfo
- type Config
- type GitService
- func (g *GitService) CleanupOldWorktrees(maxAge time.Duration) error
- func (g *GitService) CleanupOrphanedWorktrees(db *gorm.DB) error
- func (g *GitService) CommitChanges(worktreePath, message string) (string, error)
- func (g *GitService) CreateBranch(repoPath, branchName, baseBranch string) error
- func (g *GitService) CreateWorktree(repoPath, branchName, baseBranch string) (string, error)
- func (g *GitService) GetBranchDiff(repoPath, baseBranch, targetBranch string) (string, error)
- func (g *GitService) GetBranches(repoPath string) ([]string, error)
- func (g *GitService) GetCommitInfo(repoPath, commitHash string) (*CommitInfo, error)
- func (g *GitService) GetDiff(worktreePath string) (string, error)
- func (g *GitService) GetDiffFromBaseBranch(worktreePath, baseBranch string) (string, error)
- func (g *GitService) GetRepositoryStatus(repoPath string) (*RepositoryStatus, error)
- func (g *GitService) PushBranch(worktreePath, branchName string) error
- func (g *GitService) RemoveWorktree(repoPath, worktreePath string) error
- func (g *GitService) ValidateRepository(repoPath string) error
- type GitSessionInfo
- type Input
- type InputMessage
- type InputMessageContent
- type Message
- type Process
- type ProcessWithCallback
- type RepositoryStatus
- type Service
- func (s *Service) CreateSession() (*Process, error)
- func (s *Service) CreateSessionWithMultipleDirs(dirs []string) (*Process, error)
- func (s *Service) CreateSessionWithOptions(workingDir string) (*Process, error)
- func (s *Service) ReceiveMessages(process *Process) <-chan Message
- func (s *Service) SendMessage(process *Process, text string) error
- func (s *Service) StopSession(sessionID string)
- type SessionIDCallback
- type SessionIDMismatchError
- type SessionInfo
- type WSMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClaudeMDConfig ¶
type ClaudeMDConfig struct {
ID string `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"uniqueIndex;not null"`
Description string `json:"description"`
Content string `json:"content" gorm:"type:text;not null"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
IsDefault bool `json:"is_default" gorm:"default:false"`
}
ClaudeMDConfig represents a CLAUDE.md configuration
type ClaudeMDConfigListResponse ¶
type ClaudeMDConfigListResponse struct {
Configs []ClaudeMDConfig `json:"configs"`
Total int `json:"total"`
}
ClaudeMDConfigListResponse represents the response for listing configurations
type ClaudeMDCreateRequest ¶
type ClaudeMDCreateRequest struct {
Name string `json:"name" binding:"required"`
Description string `json:"description"`
Content string `json:"content" binding:"required"`
}
ClaudeMDCreateRequest represents the request for creating a configuration
type ClaudeMDUpdateRequest ¶
type ClaudeMDUpdateRequest struct {
Name *string `json:"name"`
Description *string `json:"description"`
Content *string `json:"content"`
}
ClaudeMDUpdateRequest represents the request for updating a configuration
type ClaudeMessage ¶
type ClaudeMessage struct {
Type string `json:"type"`
Subtype string `json:"subtype,omitempty"`
Message json.RawMessage `json:"message,omitempty"`
SessionID string `json:"session_id,omitempty"`
ParentID string `json:"parent_tool_use_id,omitempty"`
Result string `json:"result,omitempty"`
IsError bool `json:"is_error,omitempty"`
}
ClaudeMessage represents a message from Claude CLI
type ClaudeService ¶
type ClaudeService struct {
// contains filtered or unexported fields
}
ClaudeService provides database-integrated Claude session management
func NewClaudeService ¶
func NewClaudeService(d deps.Deps) *ClaudeService
NewClaudeService creates a new database-integrated Claude service
func (*ClaudeService) CleanupSessionWorktree ¶
func (cs *ClaudeService) CleanupSessionWorktree(sessionID, userID string) error
CleanupSessionWorktree removes the git worktree for a Claude session
func (*ClaudeService) CommitSessionChanges ¶
func (cs *ClaudeService) CommitSessionChanges(sessionID, userID, commitMessage string) (string, error)
CommitSessionChanges commits changes in a Claude session's git worktree
func (*ClaudeService) CreateClaudeMDConfig ¶
func (cs *ClaudeService) CreateClaudeMDConfig(req *ClaudeMDCreateRequest) (*ClaudeMDConfig, error)
CreateClaudeMDConfig creates a new CLAUDE.md configuration
func (*ClaudeService) CreateGitSessionWithPersistence ¶
func (cs *ClaudeService) CreateGitSessionWithPersistence(threadTS, channelID, userID, repoPath, baseBranch string) (*Process, *SessionInfo, *GitSessionInfo, error)
CreateGitSessionWithPersistence creates a new Claude session with git repository integration
func (*ClaudeService) CreateGitSessionWithPersistenceAndConfig ¶
func (cs *ClaudeService) CreateGitSessionWithPersistenceAndConfig(threadTS, channelID, userID, repoPath, baseBranch, configID string) (*Process, *SessionInfo, *GitSessionInfo, error)
func (*ClaudeService) CreateSessionWithCallbackFix ¶
func (cs *ClaudeService) CreateSessionWithCallbackFix(threadTS, channelID, userID, workingDir string) (*ProcessWithCallback, *SessionInfo, error)
CreateSessionWithCallbackFix creates a Claude session that properly handles session ID mismatches
func (*ClaudeService) CreateSessionWithDeferredDirectory ¶
func (cs *ClaudeService) CreateSessionWithDeferredDirectory(threadTS, channelID, userID, workingDir string) (*Process, *SessionInfo, error)
CreateSessionWithDeferredDirectory creates a Claude session but defers session directory creation until we get the actual session ID from Claude. This fixes the session ID mismatch issue.
func (*ClaudeService) CreateSessionWithPersistence ¶
func (cs *ClaudeService) CreateSessionWithPersistence(threadTS, channelID, userID, workingDir string) (*Process, *SessionInfo, error)
CreateSessionWithPersistence creates a new Claude session and persists it to database
func (*ClaudeService) CreateSessionWithPersistenceAndConfig ¶
func (cs *ClaudeService) CreateSessionWithPersistenceAndConfig(threadTS, channelID, userID, workingDir, configID string) (*Process, *SessionInfo, error)
CreateSessionWithPersistenceAndConfig creates a new Claude session with specified CLAUDE.md configuration
func (*ClaudeService) DeactivateSession ¶
func (cs *ClaudeService) DeactivateSession(sessionID string) error
DeactivateSession marks a session as inactive in the database
func (*ClaudeService) DeleteClaudeMDConfig ¶
func (cs *ClaudeService) DeleteClaudeMDConfig(id string) error
DeleteClaudeMDConfig deletes a CLAUDE.md configuration
func (*ClaudeService) DiagnoseSessionDirectories ¶
func (cs *ClaudeService) DiagnoseSessionDirectories() error
DiagnoseSessionDirectories scans for orphaned session directories
func (*ClaudeService) FixSessionIDMismatch ¶
func (cs *ClaudeService) FixSessionIDMismatch(goSessionID, claudeSessionID string) error
FixSessionIDMismatch moves files from Go UUID directory to Claude session directory
func (*ClaudeService) GetClaudeMDConfig ¶
func (cs *ClaudeService) GetClaudeMDConfig(id string) (*ClaudeMDConfig, error)
GetClaudeMDConfig returns a specific CLAUDE.md configuration by ID
func (*ClaudeService) GetClaudeMDConfigByName ¶
func (cs *ClaudeService) GetClaudeMDConfigByName(name string) (*ClaudeMDConfig, error)
GetClaudeMDConfigByName returns a specific CLAUDE.md configuration by name
func (*ClaudeService) GetClaudeMDConfigContent ¶
func (cs *ClaudeService) GetClaudeMDConfigContent(configName string) (string, error)
GetClaudeMDConfigContent returns the content of a CLAUDE.md configuration
func (*ClaudeService) GetDB ¶
func (cs *ClaudeService) GetDB() *gorm.DB
GetDB returns the database instance for external access
func (*ClaudeService) GetSession ¶
func (cs *ClaudeService) GetSession(sessionID, userID string) (*models.ClaudeSession, error)
GetSession returns a specific session for a user
func (*ClaudeService) GetSessionDiff ¶
func (cs *ClaudeService) GetSessionDiff(sessionID, userID string) (string, error)
GetSessionDiff returns the git diff for a Claude session
func (*ClaudeService) GetSessionGitStatus ¶
func (cs *ClaudeService) GetSessionGitStatus(sessionID, userID string) (*RepositoryStatus, error)
GetSessionGitStatus returns the git status for a Claude session
func (*ClaudeService) GetSessionInfo ¶
func (cs *ClaudeService) GetSessionInfo(threadTS, userID string) (*SessionInfo, error)
GetSessionInfo retrieves session information from database
func (*ClaudeService) GetSessions ¶
func (cs *ClaudeService) GetSessions(userID string) ([]models.ClaudeSession, error)
GetSessions returns all sessions for a user
func (*ClaudeService) HandleWebSocket ¶
func (cs *ClaudeService) HandleWebSocket(conn *websocket.Conn, userID string)
HandleWebSocket handles WebSocket connections for Claude sessions
func (*ClaudeService) InitializeClaudeMDConfigs ¶
func (cs *ClaudeService) InitializeClaudeMDConfigs() error
InitializeClaudeMDConfigs initializes default CLAUDE.md configurations
func (*ClaudeService) ListClaudeMDConfigs ¶
func (cs *ClaudeService) ListClaudeMDConfigs() (*ClaudeMDConfigListResponse, error)
ListClaudeMDConfigs returns all available CLAUDE.md configurations
func (*ClaudeService) ReceiveMessages ¶
func (cs *ClaudeService) ReceiveMessages(process *Process) <-chan Message
ReceiveMessages returns the output channel for a Claude process
func (*ClaudeService) ResumeSession ¶
func (cs *ClaudeService) ResumeSession(sessionID, userID string) (*Process, error)
ResumeSession attempts to resume an existing Claude session using --resume
func (*ClaudeService) SendMessage ¶
func (cs *ClaudeService) SendMessage(process *Process, text string) error
SendMessage sends a message to a Claude process
func (*ClaudeService) StopSession ¶
func (cs *ClaudeService) StopSession(sessionID string)
StopSession stops a Claude session and marks it as inactive
func (*ClaudeService) UpdateClaudeMDConfig ¶
func (cs *ClaudeService) UpdateClaudeMDConfig(id string, req *ClaudeMDUpdateRequest) (*ClaudeMDConfig, error)
UpdateClaudeMDConfig updates an existing CLAUDE.md configuration
func (*ClaudeService) UpdateSessionActivity ¶
func (cs *ClaudeService) UpdateSessionActivity(sessionID string) error
UpdateSessionActivity updates the last activity time for a session
func (*ClaudeService) UpdateSessionInfoWithClaudeID ¶
func (cs *ClaudeService) UpdateSessionInfoWithClaudeID(sessionInfo *SessionInfo, claudeSessionID string) error
UpdateSessionInfoWithClaudeID updates the session info once we receive Claude's session ID
func (*ClaudeService) ValidateSessionConsistency ¶
func (cs *ClaudeService) ValidateSessionConsistency(goSessionID, claudeSessionID string) error
ValidateSessionConsistency checks for session ID mismatches
type CommitInfo ¶
type GitService ¶
type GitService struct {
// contains filtered or unexported fields
}
GitService handles git operations for Claude sessions
func NewGitService ¶
func NewGitService() *GitService
NewGitService creates a new GitService instance
func (*GitService) CleanupOldWorktrees ¶
func (g *GitService) CleanupOldWorktrees(maxAge time.Duration) error
CleanupOldWorktrees removes worktrees older than the specified duration
func (*GitService) CleanupOrphanedWorktrees ¶
func (g *GitService) CleanupOrphanedWorktrees(db *gorm.DB) error
CleanupOrphanedWorktrees removes worktrees that exist on disk but are not referenced by any active sessions
func (*GitService) CommitChanges ¶
func (g *GitService) CommitChanges(worktreePath, message string) (string, error)
CommitChanges commits all changes in the worktree
func (*GitService) CreateBranch ¶
func (g *GitService) CreateBranch(repoPath, branchName, baseBranch string) error
CreateBranch creates a new branch in the repository
func (*GitService) CreateWorktree ¶
func (g *GitService) CreateWorktree(repoPath, branchName, baseBranch string) (string, error)
CreateWorktree creates a new git worktree for isolated Claude session execution
func (*GitService) GetBranchDiff ¶
func (g *GitService) GetBranchDiff(repoPath, baseBranch, targetBranch string) (string, error)
GetBranchDiff returns the diff between two branches in a repository
func (*GitService) GetBranches ¶
func (g *GitService) GetBranches(repoPath string) ([]string, error)
GetBranches returns a list of branches in the repository
func (*GitService) GetCommitInfo ¶
func (g *GitService) GetCommitInfo(repoPath, commitHash string) (*CommitInfo, error)
GetCommitInfo returns information about a commit
func (*GitService) GetDiff ¶
func (g *GitService) GetDiff(worktreePath string) (string, error)
GetDiff returns the git diff for a worktree
func (*GitService) GetDiffFromBaseBranch ¶
func (g *GitService) GetDiffFromBaseBranch(worktreePath, baseBranch string) (string, error)
GetDiffFromBaseBranch returns the diff between the current branch and base branch
func (*GitService) GetRepositoryStatus ¶
func (g *GitService) GetRepositoryStatus(repoPath string) (*RepositoryStatus, error)
GetRepositoryStatus returns the current status of the repository
func (*GitService) PushBranch ¶
func (g *GitService) PushBranch(worktreePath, branchName string) error
PushBranch pushes the current branch to origin
func (*GitService) RemoveWorktree ¶
func (g *GitService) RemoveWorktree(repoPath, worktreePath string) error
RemoveWorktree removes a git worktree
func (*GitService) ValidateRepository ¶
func (g *GitService) ValidateRepository(repoPath string) error
ValidateRepository checks if the path contains a valid Git repository
type GitSessionInfo ¶
type GitSessionInfo struct {
RepositoryPath string `json:"repository_path"`
WorktreePath string `json:"worktree_path"`
BranchName string `json:"branch_name"`
BaseBranch string `json:"base_branch"`
CommitHash string `json:"commit_hash,omitempty"`
HasChanges bool `json:"has_changes"`
}
GitSessionInfo represents git-related information for a Claude session
type Input ¶
type Input struct {
Type string `json:"type"`
Message InputMessage `json:"message"`
}
type InputMessage ¶
type InputMessage struct {
Role string `json:"role"`
Content []InputMessageContent `json:"content"`
}
type InputMessageContent ¶
type Message ¶
type Message struct {
Type string `json:"type"`
Subtype string `json:"subtype,omitempty"`
Message json.RawMessage `json:"message,omitempty"`
SessionID string `json:"session_id,omitempty"`
ParentID string `json:"parent_tool_use_id,omitempty"`
Result string `json:"result,omitempty"`
IsError bool `json:"is_error,omitempty"`
}
Message represents a message from Claude CLI
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
func (*Process) GetCorrelationID ¶
GetCorrelationID returns the correlation ID for this process
type ProcessWithCallback ¶
type ProcessWithCallback struct {
*Process
// contains filtered or unexported fields
}
ProcessWithCallback extends Process with session ID callback functionality
func (*ProcessWithCallback) SetSessionIDCallback ¶
func (p *ProcessWithCallback) SetSessionIDCallback(callback SessionIDCallback)
SetSessionIDCallback sets a callback to be executed when Claude's session ID is received
type RepositoryStatus ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CreateSession ¶
func (*Service) CreateSessionWithMultipleDirs ¶
CreateSessionWithMultipleDirs creates a new Claude session with multiple directories
func (*Service) CreateSessionWithOptions ¶
func (*Service) ReceiveMessages ¶
func (*Service) StopSession ¶
type SessionIDCallback ¶
SessionIDCallback is called when Claude's session ID is received
type SessionIDMismatchError ¶
type SessionIDMismatchError struct {
GoSessionID string
ClaudeSessionID string
DirectoryPath string
ExpectedPath string
}
SessionIDMismatchError represents a session ID mismatch issue
func (*SessionIDMismatchError) Error ¶
func (e *SessionIDMismatchError) Error() string