Skip to content

Commit 8290dea

Browse files
committed
Switch modes with slash command
1 parent debc1eb commit 8290dea

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

cli/src/commands/command-registry.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,48 @@ export const COMMAND_REGISTRY: CommandDefinition[] = [
248248
clearInput(params)
249249
},
250250
},
251+
{
252+
name: 'mode:default',
253+
aliases: [],
254+
handler: (params) => {
255+
useChatStore.getState().setAgentMode('DEFAULT')
256+
params.setMessages((prev) => [
257+
...prev,
258+
getUserMessage(params.inputValue.trim()),
259+
getSystemMessage('Switched to DEFAULT mode.'),
260+
])
261+
params.saveToHistory(params.inputValue.trim())
262+
clearInput(params)
263+
},
264+
},
265+
{
266+
name: 'mode:max',
267+
aliases: [],
268+
handler: (params) => {
269+
useChatStore.getState().setAgentMode('MAX')
270+
params.setMessages((prev) => [
271+
...prev,
272+
getUserMessage(params.inputValue.trim()),
273+
getSystemMessage('Switched to MAX mode.'),
274+
])
275+
params.saveToHistory(params.inputValue.trim())
276+
clearInput(params)
277+
},
278+
},
279+
{
280+
name: 'mode:plan',
281+
aliases: [],
282+
handler: (params) => {
283+
useChatStore.getState().setAgentMode('PLAN')
284+
params.setMessages((prev) => [
285+
...prev,
286+
getUserMessage(params.inputValue.trim()),
287+
getSystemMessage('Switched to PLAN mode.'),
288+
])
289+
params.saveToHistory(params.inputValue.trim())
290+
clearInput(params)
291+
},
292+
},
251293
]
252294

253295
export function findCommand(cmd: string): CommandDefinition | undefined {

cli/src/data/slash-commands.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,19 @@ export const SLASH_COMMANDS: SlashCommand[] = [
7979
description: 'Attach an image file (or Ctrl+V to paste from clipboard)',
8080
aliases: ['img', 'attach'],
8181
},
82+
{
83+
id: 'mode:default',
84+
label: 'mode:default',
85+
description: 'Switch to DEFAULT mode',
86+
},
87+
{
88+
id: 'mode:max',
89+
label: 'mode:max',
90+
description: 'Switch to MAX mode',
91+
},
92+
{
93+
id: 'mode:plan',
94+
label: 'mode:plan',
95+
description: 'Switch to PLAN mode',
96+
},
8297
]

0 commit comments

Comments
 (0)