Skip to content

Commit 5dc5c31

Browse files
author
Bruno Bergher
committed
Fixes saving of description when creating and editing modes
1 parent df7a9c3 commit 5dc5c31

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

packages/types/src/mode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export type CustomModesSettings = z.infer<typeof customModesSettingsSchema>
107107
export const promptComponentSchema = z.object({
108108
roleDefinition: z.string().optional(),
109109
whenToUse: z.string().optional(),
110+
description: z.string().optional(),
110111
customInstructions: z.string().optional(),
111112
})
112113

webview-ui/src/components/modes/ModesView.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
VSCodeRadio,
66
VSCodeTextArea,
77
VSCodeLink,
8+
VSCodeTextField,
89
} from "@vscode/webview-ui-toolkit/react"
910
import { Trans } from "react-i18next"
1011
import { ChevronDown, X } from "lucide-react"
@@ -106,6 +107,9 @@ const ModesView = ({ onDone }: ModesViewProps) => {
106107
if (updatedPrompt.roleDefinition === getRoleDefinition(mode)) {
107108
delete updatedPrompt.roleDefinition
108109
}
110+
if (updatedPrompt.description === getDescription(mode)) {
111+
delete updatedPrompt.description
112+
}
109113
if (updatedPrompt.whenToUse === getWhenToUse(mode)) {
110114
delete updatedPrompt.whenToUse
111115
}
@@ -195,6 +199,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
195199
// State for create mode dialog
196200
const [newModeName, setNewModeName] = useState("")
197201
const [newModeSlug, setNewModeSlug] = useState("")
202+
const [newModeDescription, setNewModeDescription] = useState("")
198203
const [newModeRoleDefinition, setNewModeRoleDefinition] = useState("")
199204
const [newModeWhenToUse, setNewModeWhenToUse] = useState("")
200205
const [newModeCustomInstructions, setNewModeCustomInstructions] = useState("")
@@ -212,6 +217,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
212217
// Reset form fields
213218
setNewModeName("")
214219
setNewModeSlug("")
220+
setNewModeDescription("")
215221
setNewModeGroups(availableGroups)
216222
setNewModeRoleDefinition("")
217223
setNewModeWhenToUse("")
@@ -732,8 +738,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
732738
<div className="text-sm text-vscode-descriptionForeground mb-2">
733739
{t("prompts:description.description")}
734740
</div>
735-
<VSCodeTextArea
736-
resize="vertical"
741+
<VSCodeTextField
737742
value={(() => {
738743
const customMode = findModeBySlug(visualMode, customModes)
739744
const prompt = customModePrompts?.[visualMode] as PromptComponent
@@ -759,8 +764,7 @@ const ModesView = ({ onDone }: ModesViewProps) => {
759764
}
760765
}}
761766
className="w-full"
762-
rows={1}
763-
data-testid={`${getCurrentMode()?.slug || "code"}-description-textarea`}
767+
data-testid={`${getCurrentMode()?.slug || "code"}-description-textfield`}
764768
/>
765769
</div>
766770

@@ -1248,6 +1252,20 @@ const ModesView = ({ onDone }: ModesViewProps) => {
12481252
)}
12491253
</div>
12501254

1255+
<div className="mb-4">
1256+
<div className="font-bold mb-1">{t("prompts:createModeDialog.description.label")}</div>
1257+
<div className="text-[13px] text-vscode-descriptionForeground mb-2">
1258+
{t("prompts:createModeDialog.description.description")}
1259+
</div>
1260+
<VSCodeTextField
1261+
value={newModeDescription}
1262+
onChange={(e) => {
1263+
setNewModeDescription((e.target as HTMLInputElement).value)
1264+
}}
1265+
className="w-full"
1266+
/>
1267+
</div>
1268+
12511269
<div className="mb-4">
12521270
<div className="font-bold mb-1">{t("prompts:createModeDialog.whenToUse.label")}</div>
12531271
<div className="text-[13px] text-vscode-descriptionForeground mb-2">

webview-ui/src/i18n/locales/en/prompts.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"description": {
3838
"title": "Short description (for humans)",
3939
"resetToDefault": "Reset to default description",
40-
"description": "A brief description of this mode that appears in the mode selector dropdown."
40+
"description": "A brief description shown in the mode selector dropdown."
4141
},
4242
"whenToUse": {
4343
"title": "When to Use (optional)",
@@ -142,9 +142,13 @@
142142
"label": "Role Definition",
143143
"description": "Define Roo's expertise and personality for this mode."
144144
},
145+
"description": {
146+
"label": "Short description (for humans)",
147+
"description": "A brief description shown in the mode selector dropdown."
148+
},
145149
"whenToUse": {
146150
"label": "When to Use (optional)",
147-
"description": "Provide a clear description of when this mode is most effective and what types of tasks it excels at."
151+
"description": "Guidance for Roo for when this mode should be used. This helps the Orchestrator choose the right mode for a task."
148152
},
149153
"tools": {
150154
"label": "Available Tools",

0 commit comments

Comments
 (0)