Unify TUI slash commands and harden tool inventory responses
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { parseCommand, getHelpText, getCommandCompletions, PROVIDER_NAMES } from './commands.js';
|
||||
import { parseCommand, getHelpText, getCommandCompletions, isToolInventoryQuery, PROVIDER_NAMES } from './commands.js';
|
||||
import { MODEL_PROVIDERS } from '../../config/index.js';
|
||||
|
||||
describe('parseCommand', () => {
|
||||
@@ -22,6 +22,20 @@ describe('parseCommand', () => {
|
||||
expect(parseCommand('/status')).toEqual({ type: 'status' });
|
||||
});
|
||||
|
||||
it('parses /tools command', () => {
|
||||
expect(parseCommand('/tools')).toEqual({ type: 'tools' });
|
||||
});
|
||||
|
||||
it('parses /research command', () => {
|
||||
expect(parseCommand('/research compare k3s and k0s')).toEqual({ type: 'research', task: 'compare k3s and k0s' });
|
||||
expect(parseCommand('/research')).toEqual({ type: 'research', task: '' });
|
||||
});
|
||||
|
||||
it('parses /council command', () => {
|
||||
expect(parseCommand('/council design backup plan')).toEqual({ type: 'council', task: 'design backup plan' });
|
||||
expect(parseCommand('/council')).toEqual({ type: 'council', task: '' });
|
||||
});
|
||||
|
||||
it('parses /fullscreen command', () => {
|
||||
expect(parseCommand('/fullscreen')).toEqual({ type: 'fullscreen' });
|
||||
expect(parseCommand('/fs')).toEqual({ type: 'fullscreen' });
|
||||
@@ -119,6 +133,9 @@ describe('getHelpText', () => {
|
||||
const help = getHelpText();
|
||||
expect(help).toContain('/help');
|
||||
expect(help).toContain('/model');
|
||||
expect(help).toContain('/tools');
|
||||
expect(help).toContain('/research');
|
||||
expect(help).toContain('/council');
|
||||
expect(help).toContain('/reset');
|
||||
expect(help).toContain('/compact');
|
||||
expect(help).toContain('/usage');
|
||||
@@ -181,3 +198,16 @@ describe('getCommandCompletions', () => {
|
||||
expect(completions).toEqual(['/model fast xai']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isToolInventoryQuery', () => {
|
||||
it('detects common capability/tool-list prompts', () => {
|
||||
expect(isToolInventoryQuery('Check out your new tools')).toBe(true);
|
||||
expect(isToolInventoryQuery('what tools do you have?')).toBe(true);
|
||||
expect(isToolInventoryQuery('show capabilities')).toBe(true);
|
||||
});
|
||||
|
||||
it('does not match unrelated prompts', () => {
|
||||
expect(isToolInventoryQuery('write a shell script')).toBe(false);
|
||||
expect(isToolInventoryQuery('summarize this doc')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user