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

Method from_checkpoint

crates/chat-cli/src/cli/chat/cli/checkpoint.rs:411–447  ·  view source on GitHub ↗
(checkpoint: &Checkpoint, manager: &CheckpointManager)

Source from the content-addressed store, hash-verified

409
410impl CheckpointDisplay {
411 fn from_checkpoint(checkpoint: &Checkpoint, manager: &CheckpointManager) -> Result<Self, eyre::Report> {
412 let mut parts = Vec::new();
413
414 // Tag
415 parts.push(format!("[{}] ", checkpoint.tag).blue());
416
417 // Content
418 if checkpoint.is_turn {
419 // Turn checkpoint: show timestamp and description
420 parts.push(
421 format!(
422 "{} - {}",
423 checkpoint.timestamp.format("%Y-%m-%d %H:%M:%S"),
424 checkpoint.description
425 )
426 .reset(),
427 );
428
429 // Add file stats if available
430 if let Some(stats) = manager.file_stats_cache.get(&checkpoint.tag) {
431 let stats_str = format_stats(stats);
432 if !stats_str.is_empty() {
433 parts.push(format!(" ({})", stats_str).dark_grey());
434 }
435 }
436 } else {
437 // Tool checkpoint: show tool name and description
438 let tool_name = checkpoint.tool_name.clone().unwrap_or_else(|| "Tool".to_string());
439 parts.push(format!("{}: ", tool_name).magenta());
440 parts.push(checkpoint.description.clone().reset());
441 }
442
443 Ok(Self {
444 tag: checkpoint.tag.clone(),
445 parts,
446 })
447 }
448}
449
450impl std::fmt::Display for CheckpointDisplay {

Callers

nothing calls this directly

Calls 6

format_statsFunction · 0.85
resetMethod · 0.80
to_stringMethod · 0.80
getMethod · 0.45
is_emptyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected