(self, os: &Os, session: &mut ChatSession)
| 86 | |
| 87 | impl CheckpointSubcommand { |
| 88 | pub async fn execute(self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> { |
| 89 | // Check if checkpoint is enabled |
| 90 | if !ExperimentManager::is_enabled(os, ExperimentName::Checkpoint) { |
| 91 | execute!( |
| 92 | session.stderr, |
| 93 | StyledText::error_fg(), |
| 94 | style::Print("\nCheckpoint is disabled. Enable it with: q settings chat.enableCheckpoint true\n"), |
| 95 | StyledText::reset(), |
| 96 | )?; |
| 97 | return Ok(ChatState::PromptUser { |
| 98 | skip_printing_tools: true, |
| 99 | }); |
| 100 | } |
| 101 | |
| 102 | // Check if in tangent mode - captures are disabled during tangent mode |
| 103 | if session.conversation.is_in_tangent_mode() { |
| 104 | execute!( |
| 105 | session.stderr, |
| 106 | StyledText::warning_fg(), |
| 107 | style::Print( |
| 108 | "⚠️ Checkpoint is disabled while in tangent mode. Please exit tangent mode if you want to use checkpoint.\n\n" |
| 109 | ), |
| 110 | StyledText::reset(), |
| 111 | )?; |
| 112 | return Ok(ChatState::PromptUser { |
| 113 | skip_printing_tools: true, |
| 114 | }); |
| 115 | } |
| 116 | match self { |
| 117 | Self::Init => self.handle_init(os, session).await, |
| 118 | Self::Restore { ref tag, hard } => self.handle_restore(session, tag.clone(), hard).await, |
| 119 | Self::List { limit } => Self::handle_list(session, limit), |
| 120 | Self::Clean => self.handle_clean(os, session).await, |
| 121 | Self::Expand { ref tag } => Self::handle_expand(session, tag.clone()), |
| 122 | Self::Diff { ref tag1, ref tag2 } => Self::handle_diff(session, tag1.clone(), tag2.clone()), |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | async fn handle_init(&self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> { |
| 127 | if session.conversation.checkpoint_manager.is_some() { |
nothing calls this directly
no test coverage detected