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 pub author: String,
64 pub timestamp: i64,
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
69pub struct LogOutput {
70 pub commits: Vec<CommitEntry>,
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
74pub struct DiffOutput {
75 pub staged: bool,
78 pub patch: String,
80 pub file_count: usize,
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
89pub struct WorktreeEntry {
90 pub path: PathBuf,
91 pub head: Option<String>,
93 pub branch: Option<String>,
95 pub owned: bool,
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
100pub struct WorktreeListOutput {
101 pub worktrees: Vec<WorktreeEntry>,
102}
103
104#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
105pub struct WorktreeStateOutput {
106 pub branch: String,
108 pub tracking: Option<String>,
110 pub ahead: u32,
111 pub behind: u32,
112 pub uncommitted: usize,
114 pub clean: bool,
115 pub sync: bool,
117}
118
119#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
120pub struct WorktreeAddOutput {
121 pub path: PathBuf,
122 pub branch: String,
123 pub session: String,
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
127pub struct WorktreeRemoveOutput {
128 pub path: PathBuf,
129}
130
131#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
136pub struct FetchOutput {
137 pub remote: String,
138 pub refspec: Option<String>,
139 pub prune: bool,
141 pub raw: String,
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
146pub struct RemoteEntry {
147 pub name: String,
148 pub fetch_url: Option<String>,
149 pub push_url: Option<String>,
150}
151
152#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
153pub struct RemoteListOutput {
154 pub remotes: Vec<RemoteEntry>,
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
158pub struct BranchStatusOutput {
159 pub branch: String,
160 pub base: String,
161 pub ahead: u32,
162 pub behind: u32,
163 pub up_to_date: bool,
164 pub common_ancestor: Option<String>,
166}
167
168#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
169pub struct UnpushedCommitsOutput {
170 pub branch: String,
171 pub remote: String,
172 pub remote_head: String,
174 pub count: usize,
175 pub commits: Vec<CommitEntry>,
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
179pub struct IsPushedOutput {
180 pub commit: String,
181 pub remote: String,
182 pub pushed: bool,
183 pub refs: Vec<String>,
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
188pub struct TagPushedOutput {
189 pub tag: String,
190 pub remote: String,
191 pub pushed: bool,
192 pub remote_refs: Vec<String>,
194}
195
196#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
201pub struct CommitOutput {
202 pub sha: String,
203 pub short_sha: String,
204 pub message: String,
205 pub files_changed: usize,
206}
207
208#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Eq)]
214#[serde(rename_all = "snake_case")]
215pub enum OtherStagedMode {
216 #[default]
219 Stop,
220 Restage,
224}
225
226#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
227pub struct MergeOutput {
228 pub branch: String,
229 pub into_branch: String,
230 pub sha: String,
232 pub short_sha: String,
233 pub raw: String,
235}
236
237#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
238pub struct BranchDeleteOutput {
239 pub branch: String,
240}
241
242#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
247#[serde(rename_all = "snake_case")]
248pub enum ResetMode {
249 Soft,
250 Mixed,
251 Hard,
252}
253
254#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
255pub struct ResetOutput {
256 pub mode: ResetMode,
257 pub target: String,
259 pub previous_head: String,
261 pub current_head: String,
263}
264
265#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
270pub struct SessionReleaseOutput {
271 pub adopted_worktrees: Vec<PathBuf>,
273 pub adopted_branches: Vec<String>,
275}