fix: remove 'Full command' description and use correct translation keys

- Removed the 'Full command' description from the first pattern
- Updated translation keys to use existing ones from chat.json
- Fixed tooltip to use Trans component with settings link
- Updated tests to match the changes
This commit is contained in:
Daniel Riccio 2025-07-25 10:41:40 -05:00
parent 851617c0ff
commit 77bc9e6f92
No known key found for this signature in database
GPG key ID: FFD5FD825F8E8209
2 changed files with 18 additions and 26 deletions

View file

@ -33,7 +33,7 @@ export const CommandPatternSelector: React.FC<CommandPatternSelectorProps> = ({
// Create a combined list with full command first, then patterns
const allPatterns = useMemo(() => {
const fullCommandPattern = { pattern: command, description: "Full command" }
const fullCommandPattern: CommandPattern = { pattern: command }
return [fullCommandPattern, ...patterns]
}, [command, patterns])
@ -65,37 +65,30 @@ export const CommandPatternSelector: React.FC<CommandPatternSelectorProps> = ({
"-rotate-90": !isExpanded,
})}
/>
<span className="text-sm font-medium">{t("chat:commandExecution.commandPermissions")}</span>
<span className="text-sm font-medium">{t("chat:commandExecution.manageCommands")}</span>
<StandardTooltip
content={
<div className="space-y-2 max-w-xs">
<p>{t("chat:commandExecution.permissionsTooltip")}</p>
<p>
<Trans
i18nKey="chat:commandExecution.learnMore"
components={{
link: (
<VSCodeLink
href="https://docs.roo-code.com/features/command-permissions"
className="text-vscode-textLink-foreground hover:text-vscode-textLink-activeForeground"
/>
),
}}
/>
</p>
<div className="max-w-xs">
<Trans
i18nKey="chat:commandExecution.commandManagementDescription"
components={{
settingsLink: (
<VSCodeLink
href="command:workbench.action.openSettings?%5B%22roo-code%22%5D"
className="text-vscode-textLink-foreground hover:text-vscode-textLink-activeForeground"
/>
),
}}
/>
</div>
}>
<Info className="size-3.5 text-vscode-descriptionForeground" />
</StandardTooltip>
</div>
<div className="flex items-center gap-2 text-xs text-vscode-descriptionForeground">
<span>
{allowedCommands.length} {t("chat:commandExecution.allowed")}
</span>
<span>{allowedCommands.length} allowed</span>
<span></span>
<span>
{deniedCommands.length} {t("chat:commandExecution.denied")}
</span>
<span>{deniedCommands.length} denied</span>
</div>
</button>

View file

@ -48,7 +48,7 @@ describe("CommandPatternSelector", () => {
expect(container).toBeTruthy()
// Check for the command permissions text
expect(screen.getByText("chat:commandExecution.commandPermissions")).toBeInTheDocument()
expect(screen.getByText("chat:commandExecution.manageCommands")).toBeInTheDocument()
})
it("should show full command as first pattern when expanded", () => {
@ -62,9 +62,8 @@ describe("CommandPatternSelector", () => {
const expandButton = screen.getByRole("button")
fireEvent.click(expandButton)
// Check that the full command is shown with description
// Check that the full command is shown
expect(screen.getByText("npm install express")).toBeInTheDocument()
expect(screen.getByText("- Full command")).toBeInTheDocument()
})
it("should show extracted patterns when expanded", () => {