renderToolCallsDiffPrettySection renders the engine-level tool calls diff as a pretty console sub-section. It shows a high-level table of all tool types and a dedicated bash commands breakdown.
(run1ID, run2ID int64, diff *ToolCallsDiff)
| 657 | // renderToolCallsDiffPrettySection renders the engine-level tool calls diff as a pretty console sub-section. |
| 658 | // It shows a high-level table of all tool types and a dedicated bash commands breakdown. |
| 659 | func renderToolCallsDiffPrettySection(run1ID, run2ID int64, diff *ToolCallsDiff) { |
| 660 | if diff == nil { |
| 661 | return |
| 662 | } |
| 663 | |
| 664 | fmt.Fprintln(os.Stderr, console.FormatSectionHeader("Tool Call Breakdown")) |
| 665 | fmt.Fprintln(os.Stderr) |
| 666 | |
| 667 | // All-tools overview table |
| 668 | if len(diff.AllTools) > 0 { |
| 669 | config := console.TableConfig{ |
| 670 | Headers: []string{"Tool", fmt.Sprintf("Run #%d", run1ID), fmt.Sprintf("Run #%d", run2ID), "Change"}, |
| 671 | Rows: make([][]string, 0, len(diff.AllTools)), |
| 672 | } |
| 673 | for _, entry := range diff.AllTools { |
| 674 | change := entry.CallCountChange |
| 675 | if change == "" { |
| 676 | change = "—" |
| 677 | } |
| 678 | config.Rows = append(config.Rows, []string{ |
| 679 | entry.Name, |
| 680 | strconv.Itoa(entry.Run1CallCount), |
| 681 | strconv.Itoa(entry.Run2CallCount), |
| 682 | change, |
| 683 | }) |
| 684 | } |
| 685 | fmt.Fprint(os.Stderr, console.RenderTable(config)) |
| 686 | } |
| 687 | |
| 688 | // Bash-specific breakdown |
| 689 | if diff.BashDiff != nil { |
| 690 | fmt.Fprintln(os.Stderr) |
| 691 | renderBashCommandsDiffPrettySection(run1ID, run2ID, diff.BashDiff) |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | // renderBashCommandsDiffPrettySection renders the bash commands breakdown as a pretty console sub-section. |
| 696 | func renderBashCommandsDiffPrettySection(run1ID, run2ID int64, diff *BashCommandsDiff) { |
no test coverage detected