From fc5e411d5107ea50013561809ae710e4cc8a2da8 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 9 Oct 2025 15:47:57 -0700 Subject: [PATCH] Add description truncation for slash commands in CLI UI --- extensions/cli/.gitignore | 3 ++- extensions/cli/src/ui/SlashCommandUI.tsx | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/extensions/cli/.gitignore b/extensions/cli/.gitignore index f3e655274..67557ca37 100644 --- a/extensions/cli/.gitignore +++ b/extensions/cli/.gitignore @@ -13,4 +13,5 @@ config.yaml .continue-debug/ *.expect -!demo.expect \ No newline at end of file +!demo.expect +*.cast \ No newline at end of file diff --git a/extensions/cli/src/ui/SlashCommandUI.tsx b/extensions/cli/src/ui/SlashCommandUI.tsx index b3d5765e3..567ab5cfd 100644 --- a/extensions/cli/src/ui/SlashCommandUI.tsx +++ b/extensions/cli/src/ui/SlashCommandUI.tsx @@ -4,6 +4,15 @@ import React, { useMemo } from "react"; import { getAllSlashCommands } from "../commands/commands.js"; +const MAX_DESCRIPTION_LENGTH = 80; + +const truncateDescription = (description: string): string => { + if (description.length <= MAX_DESCRIPTION_LENGTH) { + return description; + } + return description.slice(0, MAX_DESCRIPTION_LENGTH).trim() + "…"; +}; + interface SlashCommandUIProps { assistant?: AssistantConfig; filter: string; @@ -74,7 +83,7 @@ const SlashCommandUI: React.FC = ({ {paddedCommandName} {" "} - {command.description} + {truncateDescription(command.description)}