fix(web): hide unsupported Codex slash commands in remote mode (#357)

This commit is contained in:
Qihan
2026-03-25 05:38:25 +08:00
committed by GitHub
parent acda983e02
commit 92885ddef0
8 changed files with 127 additions and 38 deletions
+26
View File
@@ -0,0 +1,26 @@
import { describe, expect, it } from 'vitest'
import { findUnsupportedCodexBuiltinSlashCommand, getBuiltinSlashCommands } from './codexSlashCommands'
describe('getBuiltinSlashCommands', () => {
it('does not expose codex built-ins in remote web mode', () => {
expect(getBuiltinSlashCommands('codex')).toEqual([])
})
})
describe('findUnsupportedCodexBuiltinSlashCommand', () => {
it('detects unsupported codex built-ins', () => {
expect(findUnsupportedCodexBuiltinSlashCommand('/status', [])).toBe('status')
expect(findUnsupportedCodexBuiltinSlashCommand(' /diff ', [])).toBe('diff')
})
it('ignores regular messages and unknown commands', () => {
expect(findUnsupportedCodexBuiltinSlashCommand('show me status', [])).toBeNull()
expect(findUnsupportedCodexBuiltinSlashCommand('/custom-status', [])).toBeNull()
})
it('does not block custom commands that override the same name', () => {
expect(findUnsupportedCodexBuiltinSlashCommand('/status', [
{ name: 'status', source: 'project', content: 'project status prompt' }
])).toBeNull()
})
})