Skip to content

Commit 1e8e104

Browse files
authored
Add /model aliases for mode commands (#680)
1 parent 37d0892 commit 1e8e104

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

cli/src/commands/__tests__/router-input.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ describe('command-registry', () => {
210210
expect(credits).toBeDefined()
211211
expect(credits?.name).toBe('usage')
212212

213+
const modelDefault = findCommand('model:default')
214+
expect(modelDefault).toBeDefined()
215+
expect(modelDefault?.name).toBe('mode:default')
216+
213217
const quit = findCommand('quit')
214218
expect(quit).toBeDefined()
215219
expect(quit?.name).toBe('exit')
@@ -270,6 +274,18 @@ describe('command-registry', () => {
270274
}
271275
})
272276

277+
test('mode commands expose model aliases for slash suggestions', () => {
278+
const modeCommands = SLASH_COMMANDS.filter((cmd) =>
279+
cmd.id.startsWith('mode:'),
280+
)
281+
expect(modeCommands.length).toBeGreaterThan(0)
282+
283+
for (const command of modeCommands) {
284+
const modeName = command.id.slice('mode:'.length)
285+
expect(command.aliases).toContain(`model:${modeName}`)
286+
}
287+
})
288+
273289
test('connect command is not available in codebuff (freebuff-only)', () => {
274290
const hasConnectSlashCommand = SLASH_COMMANDS.some(
275291
(cmd) => cmd.id === 'connect',

cli/src/commands/command-registry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ const ALL_COMMANDS: CommandDefinition[] = [
396396
...(IS_FREEBUFF ? [] : AGENT_MODES).map((mode) =>
397397
defineCommandWithArgs({
398398
name: `mode:${mode.toLowerCase()}`,
399+
aliases: [`model:${mode.toLowerCase()}`],
399400
handler: (params, args) => {
400401
const trimmedArgs = args.trim()
401402

cli/src/data/slash-commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const MODE_COMMANDS: SlashCommand[] = IS_FREEBUFF
2929
id: `mode:${mode.toLowerCase()}`,
3030
label: `mode:${mode.toLowerCase()}`,
3131
description: `Switch to ${mode} mode`,
32+
aliases: [`model:${mode.toLowerCase()}`],
3233
}))
3334

3435
const FREEBUFF_REMOVED_COMMAND_IDS = new Set([

0 commit comments

Comments
 (0)