codewhale_command_contract/facets/
debug_operations.rs1use super::{Receipt, SessionSyncPayload};
7use std::path::PathBuf;
8
9#[derive(Debug, Clone, PartialEq, Eq)]
10pub enum DebugReceiptError {
11 ApprovalLog(String),
12 Build(String),
13}
14
15pub trait CommandDebugReceiptsContext {
16 fn receipt(&self, turn: Option<&str>) -> Result<Receipt, DebugReceiptError>;
17}
18
19#[derive(Debug, Clone, PartialEq, Eq)]
20pub struct DebugChangeProjection {
21 pub changelog: &'static str,
22 pub is_english: bool,
23 pub translation_available: bool,
24 pub translation_target: &'static str,
25}
26
27pub trait CommandDebugChangeContext {
28 fn change_projection(&self) -> DebugChangeProjection;
29}
30
31pub trait CommandDebugHistoryContext {
32 fn last_user_input(&self) -> Option<String>;
33 fn load_composer(&mut self, input: String);
34 fn undo_conversation(&mut self) -> DebugConversationUndo;
38}
39
40#[derive(Debug, Clone, PartialEq)]
43pub struct DebugConversationUndo {
44 pub removed: usize,
45 pub sync: SessionSyncPayload,
46}
47
48#[derive(Debug, Clone, PartialEq, Eq)]
49pub enum DebugDiffObservation {
50 GitUnavailable,
51 Output { names: String, stat: String },
52 Failed(String),
53}
54
55pub trait CommandDebugDiffContext {
56 fn diff(&self) -> DebugDiffObservation;
57}
58
59#[derive(Debug, Clone, Copy, PartialEq, Eq)]
60pub enum DebugRestoreAction {
61 Modified,
62 Recreated,
63 Removed,
64}
65
66#[derive(Debug, Clone, PartialEq, Eq)]
67pub struct DebugRestoredFile {
68 pub action: DebugRestoreAction,
69 pub path: PathBuf,
70}
71
72#[derive(Debug, Clone, PartialEq)]
73pub struct DebugUndoRestored {
74 pub label: String,
75 pub snapshot_id: String,
76 pub files: Vec<DebugRestoredFile>,
77 pub skipped: Vec<PathBuf>,
78 pub sync: SessionSyncPayload,
79}
80
81#[derive(Debug, Clone, PartialEq)]
82pub enum DebugUndoOutcome {
83 RepoUnavailable { workspace: PathBuf, error: String },
84 SnapshotPending,
85 NoSnapshots,
86 NoSession,
87 NoOwnedSteps,
88 NoDifference,
89 Untrusted,
90 CompareFailed(String),
91 SnapshotFailed(String),
92 ChangedSince { label: String, paths: Vec<String> },
93 ListFailed(String),
94 RestoreBlocked(String),
95 RestoreFailed(String),
96 Restored(DebugUndoRestored),
97}
98
99pub trait CommandDebugUndoContext {
100 fn undo_files(&mut self) -> DebugUndoOutcome;
104}