| 409 | |
| 410 | impl 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 | |
| 450 | impl std::fmt::Display for CheckpointDisplay { |