MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / handle_clean

Method handle_clean

crates/chat-cli/src/cli/chat/cli/checkpoint.rs:260–297  ·  view source on GitHub ↗
(&self, os: &Os, session: &mut ChatSession)

Source from the content-addressed store, hash-verified

258 }
259
260 async fn handle_clean(&self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> {
261 let Some(manager) = session.conversation.checkpoint_manager.take() else {
262 execute!(
263 session.stderr,
264 StyledText::warning_fg(),
265 style::Print("⚠️ ️Checkpoints not enabled.\n"),
266 StyledText::reset(),
267 )?;
268 return Ok(ChatState::PromptUser {
269 skip_printing_tools: true,
270 });
271 };
272
273 // Print the path that will be deleted
274 execute!(
275 session.stderr,
276 style::Print(format!("Deleting: {}\n", manager.shadow_repo_path.display()))
277 )?;
278
279 match manager.cleanup(os).await {
280 Ok(()) => {
281 execute!(
282 session.stderr,
283 style::SetAttribute(Attribute::Bold),
284 style::Print("✓ Deleted shadow repository for this session.\n"),
285 StyledText::reset_attributes(),
286 )?;
287 },
288 Err(e) => {
289 session.conversation.checkpoint_manager = Some(manager);
290 return Err(ChatError::Custom(format!("Failed to clean: {e}").into()));
291 },
292 }
293
294 Ok(ChatState::PromptUser {
295 skip_printing_tools: true,
296 })
297 }
298
299 fn handle_expand(session: &mut ChatSession, tag: String) -> Result<ChatState, ChatError> {
300 let Some(manager) = session.conversation.checkpoint_manager.as_ref() else {

Callers 1

executeMethod · 0.80

Calls 2

CustomClass · 0.85
cleanupMethod · 0.80

Tested by

no test coverage detected