eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
//! Message types for TEA pattern.
//!
//! Messages describe what happened (events) or what should happen (intents).
//! They are the ONLY way to change application state.
//!
//! ## Naming Conventions
//!
//! - `Request*` — User intent, may trigger side effects
//! - `*Started` — Side effect has begun
//! - `*Success` — Side effect completed successfully  
//! - `*Failed` — Side effect failed with error
//! - `Set*` — Pure state update, no side effects
//! - `*Up/*Down` — Navigation events

/// Messages that drive state changes in the application.
/// 
/// Following TEA, these are the ONLY way to modify state.
/// The update function matches on these and returns new state + effects.
#[derive(Debug, Clone)]
pub enum Msg {
    // =========================================================================
    // Lifecycle Messages
    // =========================================================================
    
    /// Application tick (for periodic updates).
    Tick,
    
    /// Request to quit the application.
    RequestQuit,
    
    // =========================================================================
    // Git Operation Requests (trigger Effects)
    // =========================================================================
    
    /// Request to stage a file.
    RequestStage { path: String },
    
    /// Request to unstage a file.
    RequestUnstage { path: String },
    
    /// Request to commit.
    RequestCommit {
        message: String,
        amend: bool,
    },
    
    /// Request to push.
    RequestPush { force: bool },
    
    /// Request rebase continue.
    RequestRebaseContinue {
        message: Option<String>,
        author_name: Option<String>,
        author_email: Option<String>,
    },
    
    /// Request rebase abort.
    RequestRebaseAbort,
    
    // =========================================================================
    // Git Operation Results (from Effect handlers)
    // =========================================================================
    
    /// Staging started.
    StageStarted { path: String },
    
    /// Staging completed successfully.
    StageSuccess { path: String },
    
    /// Staging failed.
    StageFailed { path: String, error: String },
    
    /// Commit started.
    CommitStarted,
    
    /// Commit succeeded.
    CommitSuccess { hash: String },
    
    /// Commit failed.
    CommitFailed { error: String },
    
    /// Rebase operation started.
    RebaseStarted,
    
    /// Rebase operation succeeded.
    RebaseSuccess { outcome: RebaseOutcome },
    
    /// Rebase operation failed.
    RebaseFailed { error: String },
    
    /// Status refresh completed.
    StatusRefreshed { entries: Vec<StatusEntryData> },
    
    /// Status refresh failed.
    StatusRefreshFailed { error: String },
    
    /// Diff computed.
    DiffComputed { path: String, content: String, truncated: bool },
    
    // =========================================================================
    // Navigation (pure state updates)
    // =========================================================================
    
    /// Navigate up in current list.
    NavigateUp,
    
    /// Navigate down in current list.
    NavigateDown,
    
    /// Navigate to top of current list.
    NavigateTop,
    
    /// Navigate to bottom of current list.
    NavigateBottom,
    
    /// Page up in current list.
    PageUp,
    
    /// Page down in current list.
    PageDown,
    
    /// Focus next pane.
    FocusNext,
    
    /// Focus previous pane.
    FocusPrev,
    
    // =========================================================================
    // UI State (pure state updates)
    // =========================================================================
    
    /// Toggle help overlay.
    ToggleHelp,
    
    /// Show theme picker.
    ShowThemePicker,
    
    /// Hide theme picker.
    HideThemePicker,
    
    /// Apply a theme.
    ApplyTheme { name: String },
    
    /// Set feedback message.
    SetFeedback { message: Option<String> },
    
    /// Set error with guidance.
    SetError { error: Option<String>, guidance: Option<String> },
    
    /// Clear any error state.
    ClearError,
    
    // =========================================================================
    // Input Mode
    // =========================================================================
    
    /// Start commit input mode.
    StartCommitInput,
    
    /// Cancel commit input.
    CancelCommitInput,
    
    /// Update commit input text.
    UpdateCommitInput { text: String },
    
    /// Character input.
    CharInput { ch: char },
    
    /// Backspace in input.
    Backspace,
}

/// Outcome of a rebase operation.
#[derive(Debug, Clone)]
pub enum RebaseOutcome {
    /// Rebase completed successfully.
    Completed,
    /// Rebase is paused for editing.
    PausedForEdit,
    /// Rebase is paused for reword.
    PausedForReword { commit_hash: String, current_message: String },
    /// Rebase has conflicts.
    Conflicts { files: Vec<String> },
}

/// Simplified status entry for message passing.
#[derive(Debug, Clone)]
pub struct StatusEntryData {
    pub path: String,
    pub staged: bool,
    pub unstaged: bool,
    pub conflict: bool,
}