1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Type definitions for the TUI module
//!
//! Contains enums and basic structs used throughout the TUI.
//! Method implementations are in `type_impls.rs`.
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
#[cfg(feature = "web-monitoring")]
use utoipa::ToSchema;
/// View mode for TUI navigation
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub enum ViewMode {
/// Changes view - display and manage changes
#[default]
Changes,
/// Worktrees view - display and manage git worktrees
Worktrees,
}
/// Stop mode for graceful/force stop handling
#[derive(Debug, Clone, PartialEq, Default)]
pub enum StopMode {
/// Not stopping, normal operation
#[default]
None,
/// Graceful stop requested, waiting for current process
GracefulPending,
/// Force stop executed
ForceStopped,
}
/// Application mode
#[derive(Debug, Clone, PartialEq)]
pub enum AppMode {
/// Selection mode - user selects changes to process
Select,
/// Running mode - processing selected changes
Running,
/// Stopping mode - graceful stop in progress
Stopping,
/// Stopped mode - processing halted, can modify queue
Stopped,
/// Error mode - an error occurred during processing
Error,
/// Confirmation dialog for worktree deletion
ConfirmWorktreeDelete,
/// QR popup mode - showing Web UI QR code
QrPopup,
/// Force-kill confirmation for a single active change
ConfirmForceKill {
/// The change ID being confirmed for force-kill
change_id: String,
},
}
/// Information about a git worktree
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "web-monitoring", derive(ToSchema))]
pub struct WorktreeInfo {
/// Path to the worktree
#[cfg_attr(feature = "web-monitoring", schema(value_type = String))]
pub path: PathBuf,
/// Current HEAD commit (short hash or symbolic ref)
pub head: String,
/// Branch name (empty if detached)
pub branch: String,
/// Whether HEAD is detached
pub is_detached: bool,
/// Whether this is the main worktree
pub is_main: bool,
/// Merge conflict information (None if not checked or no conflicts)
pub merge_conflict: Option<MergeConflictInfo>,
/// Whether this worktree has commits ahead of the base branch
pub has_commits_ahead: bool,
/// Whether a merge operation is in progress for this worktree
pub is_merging: bool,
}
/// Merge conflict information for a worktree
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "web-monitoring", derive(ToSchema))]
pub struct MergeConflictInfo {
/// List of files with merge conflicts
pub conflict_files: Vec<String>,
}
/// Action to perform on a worktree
#[derive(Debug, Clone, PartialEq)]
pub enum WorktreeAction {
/// Delete the worktree
Delete,
}