1use std::path::PathBuf;
13
14use serde::{Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
22pub struct EntryStatus {
23 pub path: PathBuf,
24 pub kind: StatusKind,
25}
26
27#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
28#[serde(rename_all = "snake_case")]
29pub enum StatusKind {
30 New,
31 Modified,
32 Deleted,
33 Renamed,
34 Typechange,
35 Conflicted,
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
39pub struct StatusOutput {
40 pub branch: Option<String>,
42 pub head_sha: Option<String>,
44 pub staged: Vec<EntryStatus>,
46 pub unstaged: Vec<EntryStatus>,
48 pub untracked: Vec<PathBuf>,
50 pub clean: bool,
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
55pub struct CommitEntry {
56 pub sha: String,
58 pub short_sha: String,
60 pub summary: String,
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
65pub struct LogOutput {
66 pub commits: Vec<CommitEntry>,
67}
68
69#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
70pub struct DiffOutput {
71 pub staged: bool,
74 pub patch: String,
76 pub file_count: usize,
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
85pub struct WorktreeEntry {
86 pub path: PathBuf,
87 pub head: Option<String>,
89 pub branch: Option<String>,
91 pub owned: bool,
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
96pub struct WorktreeListOutput {
97 pub worktrees: Vec<WorktreeEntry>,
98}
99
100#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
101pub struct WorktreeStateOutput {
102 pub branch: String,
104 pub tracking: Option<String>,
106 pub ahead: u32,
107 pub behind: u32,
108 pub uncommitted: usize,
110 pub clean: bool,
111 pub sync: bool,
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
116pub struct WorktreeAddOutput {
117 pub path: PathBuf,
118 pub branch: String,
119 pub session: String,
120}
121
122#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
123pub struct WorktreeRemoveOutput {
124 pub path: PathBuf,
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
132pub struct FetchOutput {
133 pub remote: String,
134 pub refspec: Option<String>,
135 pub prune: bool,
137 pub raw: String,
139}
140
141#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
142pub struct RemoteEntry {
143 pub name: String,
144 pub fetch_url: Option<String>,
145 pub push_url: Option<String>,
146}
147
148#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
149pub struct RemoteListOutput {
150 pub remotes: Vec<RemoteEntry>,
151}
152
153#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
154pub struct BranchStatusOutput {
155 pub branch: String,
156 pub base: String,
157 pub ahead: u32,
158 pub behind: u32,
159 pub up_to_date: bool,
160 pub common_ancestor: Option<String>,
162}
163
164#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
165pub struct UnpushedCommitsOutput {
166 pub branch: String,
167 pub remote: String,
168 pub remote_head: String,
170 pub count: usize,
171 pub commits: Vec<CommitEntry>,
172}
173
174#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
175pub struct IsPushedOutput {
176 pub commit: String,
177 pub remote: String,
178 pub pushed: bool,
179 pub refs: Vec<String>,
181}
182
183#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
184pub struct TagPushedOutput {
185 pub tag: String,
186 pub remote: String,
187 pub pushed: bool,
188 pub remote_refs: Vec<String>,
190}
191
192#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
197pub struct CommitOutput {
198 pub sha: String,
199 pub short_sha: String,
200 pub message: String,
201 pub files_changed: usize,
202}
203
204#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
205pub struct MergeOutput {
206 pub branch: String,
207 pub into_branch: String,
208 pub sha: String,
210 pub short_sha: String,
211 pub raw: String,
213}
214
215#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
216pub struct BranchDeleteOutput {
217 pub branch: String,
218}
219
220#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
225#[serde(rename_all = "snake_case")]
226pub enum ResetMode {
227 Soft,
228 Mixed,
229 Hard,
230}
231
232#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
233pub struct ResetOutput {
234 pub mode: ResetMode,
235 pub target: String,
237 pub previous_head: String,
239 pub current_head: String,
241}
242
243#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
248pub struct SessionReleaseOutput {
249 pub adopted_worktrees: Vec<PathBuf>,
251 pub adopted_branches: Vec<String>,
253}