diff --git a/package-lock.json b/package-lock.json index d275e2c9f..05b96b8ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "express": "^5.1.0", "glob": "^11.0.3", "gpt-tokenizer": "^3.0.1", + "gradient-string": "^3.0.0", "ignore-walk": "^7.0.0", "ink": "^6.0.1", "jszip": "^3.10.1", @@ -5957,6 +5958,12 @@ "@types/node": "*" } }, + "node_modules/@types/tinycolor2": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/@types/tinycolor2/-/tinycolor2-1.4.6.tgz", + "integrity": "sha512-iEN8J0BoMnsWBqjVbWH/c0G0Hh7O21lpR2/+PrvAVgWdzL7eexIFm4JN/Wn10PTcmNdtS6U67r499mlWMXOxNw==", + "license": "MIT" + }, "node_modules/@types/triple-beam": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", @@ -10322,6 +10329,19 @@ "dev": true, "license": "ISC" }, + "node_modules/gradient-string": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/gradient-string/-/gradient-string-3.0.0.tgz", + "integrity": "sha512-frdKI4Qi8Ihp4C6wZNB565de/THpIaw3DjP5ku87M+N9rNSGmPTjfkq61SdRXB7eCaL8O1hkKDvf6CDMtOzIAg==", + "license": "MIT", + "dependencies": { + "chalk": "^5.3.0", + "tinygradient": "^1.1.5" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -18113,6 +18133,12 @@ "dev": true, "license": "MIT" }, + "node_modules/tinycolor2": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==", + "license": "MIT" + }, "node_modules/tinyexec": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", @@ -18165,6 +18191,16 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/tinygradient": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/tinygradient/-/tinygradient-1.1.5.tgz", + "integrity": "sha512-8nIfc2vgQ4TeLnk2lFj4tRLvvJwEfQuabdsmvDdQPT0xlk9TaNtpGd6nNRxXoK6vQhN6RSzj+Cnp5tTQmpxmbw==", + "license": "MIT", + "dependencies": { + "@types/tinycolor2": "^1.4.0", + "tinycolor2": "^1.0.0" + } + }, "node_modules/tinypool": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", diff --git a/package.json b/package.json index f4e77a052..b25d19c1b 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "express": "^5.1.0", "glob": "^11.0.3", "gpt-tokenizer": "^3.0.1", + "gradient-string": "^3.0.0", "ignore-walk": "^7.0.0", "ink": "^6.0.1", "jszip": "^3.10.1", diff --git a/src/asciiArt.ts b/src/asciiArt.ts index 772772d49..0afb4c041 100644 --- a/src/asciiArt.ts +++ b/src/asciiArt.ts @@ -1,74 +1,69 @@ import chalk from "chalk"; +import { mind } from "gradient-string"; import { getVersion } from "./version.js"; -const b = chalk.bold.magenta; const d = chalk.dim; export const CONTINUE_ASCII_ART = ` - ${b("_____")}${d("____ ")}${b("_ __")}${d("___________ ____ ______")} - ${b("/ ___/")}${d(" __ \\")}${b("/ |/ /")}${d("_ __/ _/ |/ / / / / __/")} -${b("/ /__")}${d("/ /_/ ")}${b("/ /")}${d(" / / _/ // / /_/ / _/ ")} -${b("\\___/")}${d("\\____")}${b("/_/|_/")}${d(" /_/ /___/_/|_/\\____/___/")} - - ${d("v" + getVersion())}`; -// export const CONTINUE_ASCII_ART = ` -// _________ _ _____________ ____ ______ -// / ___/ __ \\/ |/ /_ __/ _/ |/ / / / / __/ -// / /__/ /_/ / / / / _/ // / /_/ / _/ -// \\___/\\____/_/|_/ /_/ /___/_/|_/\\____/___/ -// `; +${mind.multiline(` ██████╗ ██████╗ ███╗ ██╗████████╗██╗███╗ ██╗██╗ ██╗███████╗ + ██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝██║████╗ ██║██║ ██║██╔════╝ + ██║ ██║ ██║██╔██╗ ██║ ██║ ██║██╔██╗ ██║██║ ██║█████╗ + ██║ ██║ ██║██║╚██╗██║ ██║ ██║██║╚██╗██║██║ ██║██╔══╝ + ╚██████╗╚██████╔╝██║ ╚████║ ██║ ██║██║ ╚████║╚██████╔╝███████╗ + ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝`)} + ${d("v" + getVersion())}`; export const CONTINUE_LOGO_ASCII_ART = ` - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@ - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@ - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@ - @@@@@@@@@@@@ @@@@@@@@@@@@ - @@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@@@@@@@@@@ - @@@@@@@@@@@@ @@ @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@ @@@@@@@@@@@ @ - @@@@@@@@@@@@ @@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@ @@@@@@@@@@@ @@@@ - @@@@@@@@@@@@ @@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@@ - @@@@@@@@@@@@ @@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@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@@@@ + @@@@@@@@@@@@ @@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@ @@@@@@@@@@@ @@@@@@ + @@@@@@@@@@@@ @@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@ @@@@@@@@@@@ @@@@ + @@@@@@@@@@@@ @@ @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@ @@@@@@@@@@@ @ + @@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@ @@@@@@@@@@@ + @@@@@@@@@@@@ @@@@@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@ + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ `; diff --git a/src/slashCommands.ts b/src/slashCommands.ts index e86b45b8f..063645f16 100644 --- a/src/slashCommands.ts +++ b/src/slashCommands.ts @@ -77,11 +77,13 @@ type CommandHandler = ( async function handleHelp(args: string[], assistant: AssistantConfig) { const allCommands = getAllSlashCommands(assistant); const helpMessage = [ - chalk.cyan("Slash commands:"), - ...allCommands.map( - (cmd) => - `- ${chalk.white(`/${cmd.name}:`)} ${chalk.gray(cmd.description)}`, - ), + "Slash commands:", + ...allCommands + .sort((a, b) => a.name.localeCompare(b.name)) + .map( + (cmd) => + `- ${chalk.white(`/${cmd.name}:`)} ${chalk.gray(cmd.description)}`, + ), ].join("\n"); posthogService.capture("useSlashCommand", { name: "help" }); return { output: helpMessage }; diff --git a/src/ui/FileSearchUI.tsx b/src/ui/FileSearchUI.tsx index e9d63e595..48d10d07d 100644 --- a/src/ui/FileSearchUI.tsx +++ b/src/ui/FileSearchUI.tsx @@ -251,7 +251,7 @@ const FileSearchUI: React.FC = ({ - Use ↑/↓ to navigate, Enter to select, Tab to complete + ↑/↓ to navigate, Enter to select, Tab to complete diff --git a/src/ui/IntroMessage.tsx b/src/ui/IntroMessage.tsx index 5e7a10e49..6458c4a90 100644 --- a/src/ui/IntroMessage.tsx +++ b/src/ui/IntroMessage.tsx @@ -3,7 +3,6 @@ import { Box, Text } from "ink"; import React from "react"; import { parseArgs } from "../args.js"; -import { getAllSlashCommands } from "../commands/commands.js"; import { MCPService } from "../mcp.js"; import { isModelCapable } from "../utils/modelCapability.js"; @@ -22,9 +21,6 @@ const IntroMessage: React.FC = ({ }) => { const mcpPrompts = mcpService.getPrompts() ?? []; - // Get all slash commands from central definition - const allCommands = getAllSlashCommands(config); - // Show all rules in a single section const args = parseArgs(); const commandLineRules = args.rules || []; @@ -41,45 +37,40 @@ const IntroMessage: React.FC = ({ return ( {/* Agent name */} - - Agent: {config.name} + + Agent: {config.name} {/* Model */} - Model: {model.name.split("/").pop()} + Model:{" "} + {model.name.split("/").pop()} + + {/* Model capability warning */} {!modelCapable && ( <> - + )} - - - {/* Slash commands */} - Slash commands: - {allCommands.map((command, index) => ( - - - /{command.name}:{" "} - {command.description} - - ))} - {/* MCP prompts */} - {mcpPrompts.map((prompt, index) => ( - - - /{prompt.name}:{" "} - {prompt.description} - - ))} - - + {mcpPrompts.length > 0 && ( + <> + {mcpPrompts.map((prompt, index) => ( + + - /{prompt.name}:{" "} + {prompt.description} + + ))} + + + )} {/* Rules */} {allRules.length > 0 && ( @@ -97,7 +88,9 @@ const IntroMessage: React.FC = ({ {/* MCP Servers */} {config.mcpServers?.length && ( <> - MCP Servers: + + MCP Servers: + {config.mcpServers.map((server: any, index: number) => ( - {server?.name} diff --git a/src/ui/ModelCapabilityWarning.tsx b/src/ui/ModelCapabilityWarning.tsx index e74c0384f..5b9831286 100644 --- a/src/ui/ModelCapabilityWarning.tsx +++ b/src/ui/ModelCapabilityWarning.tsx @@ -9,11 +9,11 @@ const ModelCapabilityWarning: React.FC = ({ modelName, }) => { return ( - + - ⚠️ - - Model Capability Warning + + {/* spaces in brackets to prevent prettier from fixing to 1 space */} + ⚠️{" "}Model Capability Warning diff --git a/src/ui/Selector.tsx b/src/ui/Selector.tsx index ba82abce1..6d00660f0 100644 --- a/src/ui/Selector.tsx +++ b/src/ui/Selector.tsx @@ -7,6 +7,14 @@ export interface SelectorOption { displaySuffix?: string; } +const boxStyles: React.ComponentProps = { + flexDirection: "column", + paddingX: 2, + paddingY: 1, + borderStyle: "round", + borderColor: "blue", +}; + interface SelectorProps { title: string; options: T[]; @@ -52,37 +60,31 @@ export function Selector({ return; } + // loop back to the first option after the last option, and vice versa if (key.upArrow) { - onNavigate(Math.max(0, selectedIndex - 1)); + onNavigate(selectedIndex === 0 ? options.length - 1 : selectedIndex - 1); } else if (key.downArrow) { - onNavigate(Math.min(options.length - 1, selectedIndex + 1)); + onNavigate(selectedIndex === options.length - 1 ? 0 : selectedIndex + 1); } }); if (loading) { return ( - + {title} - {loadingMessage} + + + {loadingMessage} + ); } if (error) { return ( - + Error @@ -99,25 +101,25 @@ export function Selector({ isSelected: boolean, isCurrent: boolean, ) => ( - - {isSelected ? "> " : " "} - {option.name} - {option.displaySuffix || ""} - {isCurrent ? " (current)" : ""} - + <> + + {isSelected ? "→ " : " "} + {option.name} + {option.displaySuffix || ""} + + {isCurrent && ( + + {" ✔"} + + )} + ); return ( - + {title} @@ -134,7 +136,7 @@ export function Selector({ - Use ↑/↓ to navigate, Enter to select, Escape to cancel + ↑/↓ to navigate, Enter to select, Escape to cancel diff --git a/src/ui/SlashCommandUI.tsx b/src/ui/SlashCommandUI.tsx index ad0cbb8d2..b4852933f 100644 --- a/src/ui/SlashCommandUI.tsx +++ b/src/ui/SlashCommandUI.tsx @@ -45,6 +45,7 @@ const SlashCommandUI: React.FC = ({ return a.name.localeCompare(b.name); }); + if (filteredCommands.length === 0) { return ( @@ -58,12 +59,23 @@ const SlashCommandUI: React.FC = ({ {filteredCommands.map((command, index) => { const isSelected = index === selectedIndex; + // Find the longest command name to vertically align command descriptions + const maxCommandLength = Math.max( + ...filteredCommands.map((cmd) => cmd.name.length), + ); + const paddedCommandName = `/${command.name}`.padEnd( + maxCommandLength + 1, + ); + return ( - + {" "} - /{command.name} - - {command.description} + {paddedCommandName} + + {" "} + {command.description} + ); @@ -71,7 +83,7 @@ const SlashCommandUI: React.FC = ({ - Use ↑/↓ to navigate, Enter to select, Tab to complete + ↑/↓ to navigate, Enter to select, Tab to complete diff --git a/src/ui/TUIChat.tsx b/src/ui/TUIChat.tsx index b6286c157..a7dc9aedb 100644 --- a/src/ui/TUIChat.tsx +++ b/src/ui/TUIChat.tsx @@ -211,7 +211,7 @@ const BottomStatusBar: React.FC = ({ closeCurrentScreen, }) => ( - + {currentMode === "normal" && ( <> diff --git a/src/ui/UserInput.tsx b/src/ui/UserInput.tsx index 5d5a5604e..bda7cb551 100644 --- a/src/ui/UserInput.tsx +++ b/src/ui/UserInput.tsx @@ -487,10 +487,14 @@ const UserInput: React.FC = ({ return ( <> {(inputMode || isWaitingForResponse) && ( - ▋{placeholderText} + + ▋{placeholderText} + )} {!inputMode && !isWaitingForResponse && ( - {placeholderText} + + {placeholderText} + )} ); diff --git a/src/ui/__tests__/TUIChat.fileSearch.test.tsx b/src/ui/__tests__/TUIChat.fileSearch.test.tsx index 5ab4672e1..ce8e7ca20 100644 --- a/src/ui/__tests__/TUIChat.fileSearch.test.tsx +++ b/src/ui/__tests__/TUIChat.fileSearch.test.tsx @@ -19,7 +19,7 @@ describe("TUIChat - @ File Search Tests", () => { // The @ might be in the input line or in a file search UI const hasAtSymbol = frame.includes("@") || frame.includes("◉ @"); expect(hasAtSymbol).toBe(true); - + // Mode-specific UI if (mode === 'remote') { expect(frame).toContain("Remote Mode"); @@ -42,12 +42,12 @@ describe("TUIChat - @ File Search Tests", () => { // Should show the typed text expect(frame).toContain("@READ"); - + // Navigation hints only show in local mode if (mode === 'local') { - expect(frame).toContain("Use ↑/↓ to navigate"); + expect(frame).toContain("↑/↓ to navigate"); } - + // Mode-specific checks if (mode === 'remote') { expect(frame).toContain("Remote Mode"); @@ -70,7 +70,7 @@ describe("TUIChat - @ File Search Tests", () => { // Should handle multiple @ without crashing expect(frame).toBeDefined(); expect(frame).toContain("@@test"); - + // Mode-specific UI elements if (mode === 'remote') { expect(frame).toContain("Remote Mode"); @@ -93,10 +93,10 @@ describe("TUIChat - @ File Search Tests", () => { // Should not crash and show something expect(frame).toBeDefined(); expect(frame.length).toBeGreaterThan(0); - + // Navigation hints only show in local mode if (mode === 'local') { - expect(frame).toContain("Use ↑/↓ to navigate"); + expect(frame).toContain("↑/↓ to navigate"); } }); }); \ No newline at end of file diff --git a/src/ui/__tests__/TUIChat.remote.test.tsx b/src/ui/__tests__/TUIChat.remote.test.tsx index a279c084b..887baa2c6 100644 --- a/src/ui/__tests__/TUIChat.remote.test.tsx +++ b/src/ui/__tests__/TUIChat.remote.test.tsx @@ -23,7 +23,7 @@ describe("TUIChat - Remote Server Tests", () => { ); const frame = lastFrame(); - + expect(frame).toBeDefined(); expect(frame).toContain("Remote Mode"); expect(frame).toContain("Ask anything"); @@ -34,7 +34,7 @@ describe("TUIChat - Remote Server Tests", () => { ); const frame = lastFrame(); - + // Should show remote mode in the UI expect(frame).toContain("◉ Remote Mode"); }); @@ -44,10 +44,10 @@ describe("TUIChat - Remote Server Tests", () => { ); const frame = lastFrame(); - + // Should not show loading services message expect(frame).not.toContain("Loading services"); - + // Should go directly to chat UI expect(frame).toContain("Ask anything"); }); @@ -57,7 +57,7 @@ describe("TUIChat - Remote Server Tests", () => { ); const frame = lastFrame(); - + // Should still work with different URLs expect(frame).toBeDefined(); expect(frame).toContain("Remote Mode"); @@ -78,19 +78,19 @@ describe("TUIChat - Remote Server Tests", () => { await new Promise((resolve) => setTimeout(resolve, 200)); const frame = lastFrame(); - + // Should show slash character at minimum expect(frame).toContain("/"); - + // The slash command menu might show /exit or navigation instructions // Different timing might show different states const hasSlashCommandUI = frame ? ( - frame.includes("/exit") || - frame.includes("Use ↑/↓ to navigate") || + frame.includes("/exit") || + frame.includes("↑/↓ to navigate") || frame.includes("◉ /") || frame.includes("/ for slash commands") // Placeholder text is also valid ) : false; - + expect(hasSlashCommandUI).toBe(true); }); }); \ No newline at end of file diff --git a/src/ui/__tests__/TUIChat.toolDisplay.test.tsx b/src/ui/__tests__/TUIChat.toolDisplay.test.tsx index d4e691939..5ed176eca 100644 --- a/src/ui/__tests__/TUIChat.toolDisplay.test.tsx +++ b/src/ui/__tests__/TUIChat.toolDisplay.test.tsx @@ -23,7 +23,7 @@ describe("TUIChat - Tool Display Tests", () => { ); const frame = lastFrame(); - + expect(frame).toBeDefined(); expect(frame).toContain("Ask anything"); }); @@ -33,7 +33,7 @@ describe("TUIChat - Tool Display Tests", () => { ); const frame = lastFrame(); - + // Should render normally even without tools expect(frame).toBeDefined(); expect(frame).toContain("Remote Mode"); @@ -46,11 +46,11 @@ describe("TUIChat - Tool Display Tests", () => { // Type a message that might trigger tool use stdin.write("Use a tool to help me"); - + await new Promise((resolve) => setTimeout(resolve, 50)); - + const frame = lastFrame(); - + // UI should remain stable expect(frame).toBeDefined(); if (frame) { @@ -68,24 +68,24 @@ describe("TUIChat - Tool Display Tests", () => { // Type / to see commands stdin.write("/"); - + // Wait longer for slash command menu await new Promise((resolve) => setTimeout(resolve, 200)); - + const frame = lastFrame(); - + // Should show slash command character expect(frame).toContain("/"); - + // The slash command menu might show different UI states // On Windows, the timing might be different const hasSlashCommandIndicator = frame ? ( - frame.includes("Use ↑/↓ to navigate") || + frame.includes("↑/↓ to navigate") || frame.includes("/exit") || frame.includes("◉ /") || frame.includes("/ for slash commands") ) : false; - + expect(hasSlashCommandIndicator).toBe(true); }); }); \ No newline at end of file diff --git a/src/ui/components/MemoizedMessage.tsx b/src/ui/components/MemoizedMessage.tsx index 35e94cda6..0e254f23a 100644 --- a/src/ui/components/MemoizedMessage.tsx +++ b/src/ui/components/MemoizedMessage.tsx @@ -19,7 +19,7 @@ export const MemoizedMessage = memo( switch (message.messageType) { case "tool-start": return ( - + ○ {message.content} ); @@ -29,7 +29,12 @@ export const MemoizedMessage = memo( message.toolResult?.startsWith("Permission denied") || message.toolResult?.startsWith("Error"); return ( - + ● {message.content} @@ -45,7 +50,7 @@ export const MemoizedMessage = memo( case "tool-error": return ( - + ✗{" "} @@ -55,7 +60,7 @@ export const MemoizedMessage = memo( default: return ( - + {message.content} @@ -69,6 +74,7 @@ export const MemoizedMessage = memo( return ( ( } return ( - + ● {isUser ? (