From 3515b9e261ffdb90dd12a796aa5b09178f90bc7b Mon Sep 17 00:00:00 2001 From: Bartok Moltbot Date: Fri, 27 Feb 2026 10:48:36 -0500 Subject: [PATCH] fix(cli): improve /tools and /toolsets formatting Fixes #37 Issues fixed: 1. Header title now properly centered (was off by 1 space) 2. Long descriptions now truncated with '...' instead of cut off abruptly Changes: - Calculate padding dynamically for centered headers - Add MAX_DESC constant for consistent truncation width - Show ellipsis when descriptions are truncated Before: * clarify - Ask the user a question when you need clarification, feedbac After: * clarify - Ask the user a question when you need cla... --- cli.py | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/cli.py b/cli.py index 665670e6d5c5b..6960d8cf3039c 100755 --- a/cli.py +++ b/cli.py @@ -1096,11 +1096,17 @@ def show_tools(self): print("(;_;) No tools available") return - # Header + # Header - use consistent width with centered title + WIDTH = 78 + title = "(^_^)/ Available Tools" + padding = WIDTH - len(title) + left_pad = padding // 2 + right_pad = padding - left_pad + print() - print("+" + "-" * 78 + "+") - print("|" + " " * 25 + "(^_^)/ Available Tools" + " " * 30 + "|") - print("+" + "-" * 78 + "+") + print("+" + "-" * WIDTH + "+") + print("|" + " " * left_pad + title + " " * right_pad + "|") + print("+" + "-" * WIDTH + "+") print() # Group tools by toolset @@ -1117,10 +1123,14 @@ def show_tools(self): desc = desc[:desc.index(". ") + 1] toolsets[toolset].append((name, desc)) - # Display by toolset + # Display by toolset with proper description truncation + MAX_DESC = 50 # Max description width before truncation for toolset in sorted(toolsets.keys()): print(f" [{toolset}]") for name, desc in toolsets[toolset]: + # Truncate long descriptions with ellipsis indicator + if len(desc) > MAX_DESC: + desc = desc[:MAX_DESC-3] + "..." print(f" * {name:<20} - {desc}") print() @@ -1131,18 +1141,27 @@ def show_toolsets(self): """Display available toolsets with kawaii ASCII art.""" all_toolsets = get_all_toolsets() - # Header + # Header - use consistent width with centered title + WIDTH = 58 + title = "(^_^)b Available Toolsets" + padding = WIDTH - len(title) + left_pad = padding // 2 + right_pad = padding - left_pad + print() - print("+" + "-" * 58 + "+") - print("|" + " " * 15 + "(^_^)b Available Toolsets" + " " * 17 + "|") - print("+" + "-" * 58 + "+") + print("+" + "-" * WIDTH + "+") + print("|" + " " * left_pad + title + " " * right_pad + "|") + print("+" + "-" * WIDTH + "+") print() for name in sorted(all_toolsets.keys()): info = get_toolset_info(name) if info: tool_count = info["tool_count"] - desc = info["description"][:45] + desc = info["description"] + # Truncate with ellipsis if needed + if len(desc) > 42: + desc = desc[:39] + "..." # Mark if currently enabled marker = "(*)" if self.enabled_toolsets and name in self.enabled_toolsets else " "