use super::{Receipt, SessionSyncPayload};
use std::path::PathBuf;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DebugReceiptError {
ApprovalLog(String),
Build(String),
}
pub trait CommandDebugReceiptsContext {
fn receipt(&self, turn: Option<&str>) -> Result<Receipt, DebugReceiptError>;
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DebugChangeProjection {
pub changelog: &'static str,
pub is_english: bool,
pub translation_available: bool,
pub translation_target: &'static str,
}
pub trait CommandDebugChangeContext {
fn change_projection(&self) -> DebugChangeProjection;
}
pub trait CommandDebugHistoryContext {
fn last_user_input(&self) -> Option<String>;
fn load_composer(&mut self, input: String);
fn undo_conversation(&mut self) -> DebugConversationUndo;
}
#[derive(Debug, Clone, PartialEq)]
pub struct DebugConversationUndo {
pub removed: usize,
pub sync: SessionSyncPayload,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DebugDiffObservation {
GitUnavailable,
NoBaseline,
Output {
names: String,
stat: String,
patch: String,
patch_truncated: bool,
},
Failed(String),
}
pub trait CommandDebugDiffContext {
fn diff(&self) -> DebugDiffObservation;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DebugRestoreAction {
Modified,
Recreated,
Removed,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DebugRestoredFile {
pub action: DebugRestoreAction,
pub path: PathBuf,
}
#[derive(Debug, Clone, PartialEq)]
pub struct DebugUndoRestored {
pub request: Option<String>,
pub rewind_conversation: bool,
pub forced: bool,
pub files: Vec<DebugRestoredFile>,
pub skipped: Vec<PathBuf>,
pub sync: SessionSyncPayload,
}
#[derive(Debug, Clone, PartialEq)]
pub enum DebugUndoOutcome {
RepoUnavailable {
workspace: PathBuf,
error: String,
},
SnapshotPending,
NoSnapshots,
NoSession,
NoOwnedSteps,
NoDifference,
OpenEnded,
CompareFailed(String),
SnapshotFailed(String),
ChangedSince {
paths: Vec<String>,
},
ListFailed(String),
RestoreBlocked(String),
RestoreFailed(String),
Restored(DebugUndoRestored),
}
pub trait CommandDebugUndoContext {
fn undo_files(&mut self, force: bool) -> DebugUndoOutcome;
}