From 07de75134f637d06450a727ab9429da33e39d4c8 Mon Sep 17 00:00:00 2001 From: Sam Sternberg Date: Thu, 13 Nov 2025 11:02:04 -0500 Subject: [PATCH] Improve readability of template selection menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add truncateDescription helper to limit template descriptions to 100 characters in the interactive selection menu, preventing long text from wrapping across multiple lines and improving readability. Fixes #16 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/utils/prompts.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/utils/prompts.ts b/src/utils/prompts.ts index d9fffa6..0570050 100644 --- a/src/utils/prompts.ts +++ b/src/utils/prompts.ts @@ -17,6 +17,14 @@ const TEMPLATE_NAME_MAP: Record = { 'payments_acceptance_sample': 8 }; +// Helper function to truncate long descriptions for better readability +const truncateDescription = (description: string, maxLength: number = 100): string => { + if (!description || description.length <= maxLength) { + return description; + } + return description.substring(0, maxLength).trim() + '...'; +}; + // Helper function to resolve a template name to its ID export const resolveTemplateNameToId = async (templateName: string): Promise => { // If it's already an ID format (UUID-like), return as-is @@ -135,7 +143,7 @@ export const promptForTemplateOrSchema = async (options: { template?: string, sc const sortOrder = TEMPLATE_NAME_MAP[templateNameLower] || 999; templateChoices.push({ - name: `${displayName} - ${template.description || 'No description'}`, + name: `${displayName} - ${truncateDescription(template.description || 'No description')}`, value: templateNameLower, order: sortOrder });