use std::path::PathBuf;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct EntryStatus {
pub path: PathBuf,
pub kind: StatusKind,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum StatusKind {
New,
Modified,
Deleted,
Renamed,
Typechange,
Conflicted,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct StatusOutput {
pub branch: Option<String>,
pub head_sha: Option<String>,
pub staged: Vec<EntryStatus>,
pub unstaged: Vec<EntryStatus>,
pub untracked: Vec<PathBuf>,
pub clean: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct CommitEntry {
pub sha: String,
pub short_sha: String,
pub summary: String,
pub author: String,
pub timestamp: i64,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct LogOutput {
pub commits: Vec<CommitEntry>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DiffOutput {
pub staged: bool,
pub patch: String,
pub file_count: usize,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct WorktreeEntry {
pub path: PathBuf,
pub head: Option<String>,
pub branch: Option<String>,
pub owned: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct WorktreeListOutput {
pub worktrees: Vec<WorktreeEntry>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct WorktreeStateOutput {
pub branch: String,
pub tracking: Option<String>,
pub ahead: u32,
pub behind: u32,
pub uncommitted: usize,
pub clean: bool,
pub sync: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct WorktreeAddOutput {
pub path: PathBuf,
pub branch: String,
pub session: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct WorktreeRemoveOutput {
pub path: PathBuf,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct FetchOutput {
pub remote: String,
pub refspec: Option<String>,
pub prune: bool,
pub raw: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct RemoteEntry {
pub name: String,
pub fetch_url: Option<String>,
pub push_url: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct RemoteListOutput {
pub remotes: Vec<RemoteEntry>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct BranchStatusOutput {
pub branch: String,
pub base: String,
pub ahead: u32,
pub behind: u32,
pub up_to_date: bool,
pub common_ancestor: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct UnpushedCommitsOutput {
pub branch: String,
pub remote: String,
pub remote_head: String,
pub count: usize,
pub commits: Vec<CommitEntry>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct IsPushedOutput {
pub commit: String,
pub remote: String,
pub pushed: bool,
pub refs: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct TagPushedOutput {
pub tag: String,
pub remote: String,
pub pushed: bool,
pub remote_refs: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct CommitOutput {
pub sha: String,
pub short_sha: String,
pub message: String,
pub files_changed: usize,
#[serde(default)]
pub dotfile_warnings: Vec<DotfileWarning>,
#[serde(default)]
pub dotfile_skipped: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct DotfileWarning {
pub path: String,
pub tracked: bool,
pub in_gitignore: bool,
}
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum OtherStagedMode {
#[default]
Stop,
Restage,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct MergeOutput {
pub branch: String,
pub into_branch: String,
pub sha: String,
pub short_sha: String,
pub raw: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct BranchDeleteOutput {
pub branch: String,
}
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ResetMode {
Soft,
Mixed,
Hard,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct ResetOutput {
pub mode: ResetMode,
pub target: String,
pub previous_head: String,
pub current_head: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct SessionReleaseOutput {
pub adopted_worktrees: Vec<PathBuf>,
pub adopted_branches: Vec<String>,
}