Print a reasoning summary in a readable format.
(reasoning: &TurnReasoning)
| 431 | |
| 432 | /// Print a reasoning summary in a readable format. |
| 433 | pub(crate) fn print_reasoning(reasoning: &TurnReasoning) { |
| 434 | println!(" ├── {}: {}", emphasis("Intent"), info(&reasoning.intent)); |
| 435 | println!( |
| 436 | " ├── {}: {}", |
| 437 | emphasis("Outcome"), |
| 438 | info(&reasoning.outcome) |
| 439 | ); |
| 440 | |
| 441 | // Learnings |
| 442 | if !reasoning.learnings.repo.is_empty() |
| 443 | || !reasoning.learnings.code.is_empty() |
| 444 | || !reasoning.learnings.workflow.is_empty() |
| 445 | { |
| 446 | println!(" ├── {}:", emphasis("Learnings")); |
| 447 | |
| 448 | for learning in &reasoning.learnings.code { |
| 449 | let location = if let Some(line) = learning.line { |
| 450 | if let Some(ref func) = learning.function { |
| 451 | format!("{}:{} ({})", learning.path, line, func) |
| 452 | } else { |
| 453 | format!("{}:{}", learning.path, line) |
| 454 | } |
| 455 | } else { |
| 456 | learning.path.clone() |
| 457 | }; |
| 458 | |
| 459 | let category = learning |
| 460 | .category |
| 461 | .as_deref() |
| 462 | .map(|c| format!(" [{}]", c)) |
| 463 | .unwrap_or_default(); |
| 464 | |
| 465 | println!( |
| 466 | " │ ├── {} — {}{}", |
| 467 | info(&location), |
| 468 | learning.finding, |
| 469 | hint(&category), |
| 470 | ); |
| 471 | } |
| 472 | |
| 473 | for learning in &reasoning.learnings.repo { |
| 474 | println!(" │ ├── {}: {}", hint("Repo"), learning); |
| 475 | } |
| 476 | |
| 477 | for learning in &reasoning.learnings.workflow { |
| 478 | println!(" │ ├── {}: {}", hint("Workflow"), learning); |
| 479 | } |
| 480 | } |
| 481 | |
| 482 | // Friction |
| 483 | if !reasoning.friction.is_empty() { |
| 484 | println!(" ├── {}:", emphasis("Friction")); |
| 485 | for item in &reasoning.friction { |
| 486 | println!(" │ ├── {}", item); |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | // Open items |