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