feat: support Codex goal slash command

This commit is contained in:
weishu
2026-05-15 22:15:17 +08:00
parent a099ae9199
commit 089ddad476
24 changed files with 808 additions and 6 deletions
+31
View File
@@ -46,6 +46,37 @@ describe('resolveCodexSlashCommand', () => {
});
});
it('resolves Codex goal commands for native handling', () => {
expect(resolveCodexSlashCommand('/goal', state)).toEqual({
kind: 'goal',
action: 'show'
});
expect(resolveCodexSlashCommand('/goal improve benchmark coverage', state)).toEqual({
kind: 'goal',
action: 'set',
objective: 'improve benchmark coverage'
});
expect(resolveCodexSlashCommand('/goal pause', state)).toEqual({
kind: 'goal',
action: 'pause'
});
expect(resolveCodexSlashCommand('/goal resume', state)).toEqual({
kind: 'goal',
action: 'resume'
});
expect(resolveCodexSlashCommand('/goal clear', state)).toEqual({
kind: 'goal',
action: 'clear'
});
});
it('rejects oversized Codex goal objectives', () => {
expect(resolveCodexSlashCommand(`/goal ${'x'.repeat(4001)}`, state)).toEqual({
kind: 'handled',
message: 'Goal objective must be at most 4000 characters.'
});
});
it('expands custom Codex prompt commands', () => {
expect(resolveCodexSlashCommand('/review src/index.ts', {
...state,