Add description truncation for slash commands in CLI UI

This commit is contained in:
Nate 2025-10-09 15:47:57 -07:00
parent 7318af41c1
commit fc5e411d51
2 changed files with 12 additions and 2 deletions

View file

@ -13,4 +13,5 @@ config.yaml
.continue-debug/
*.expect
!demo.expect
!demo.expect
*.cast

View file

@ -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<SlashCommandUIProps> = ({
{paddedCommandName}
<Text color={isSelected ? "blue" : "gray"}>
{" "}
{command.description}
{truncateDescription(command.description)}
</Text>
</Text>
</Box>