Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.9 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import {
  applySlashSuggestion,
  classifyNativeChatSend,
  filterSlashCommands,
  getAgentSlashCommands,
  sessionSlashCommandSuggestions,
  slashCommandDispatchText
} from './native-chat-slash-commands'

describe('OMP terminal command catalog', () => {
  it('completes arguments separately from picker command dispatch', () => {
    const matches = filterSlashCommands(getAgentSlashCommands('omp'), 'MOD')
    expect(matches).toHaveLength(1)
    const command = matches[0]
    if (!command) {
      throw new Error('Expected an OMP model suggestion')
    }
    expect(command.name).toBe('model')
    expect(applySlashSuggestion(command)).toBe('/model ')
    expect(slashCommandDispatchText(command)).toBe('/model')
  })

  it('classifies known OMP commands as terminal actions, preserving unknown and prose paths', () => {
    const commands = getAgentSlashCommands('omp')
    expect(classifyNativeChatSend('/compact focus on tests', commands, null, null)).toBe('command')
    expect(classifyNativeChatSend('/model', commands, null, null)).toBe('command')
    expect(classifyNativeChatSend('/help', commands, null, null)).toBe('unknown-token')
    expect(classifyNativeChatSend(' /model', commands, null, null)).toBe('chat')
    expect(classifyNativeChatSend('/plan', commands, '/plan', '/')).toBe('chat')
  })

  it('lets a session command report replace the curated set and descriptions', () => {
    expect(
      sessionSlashCommandSuggestions('omp', [
        { name: 'model', kind: 'command', description: 'Host model selector' },
        { name: 'custom', kind: 'command' },
        { name: 'skill:', kind: 'command' },
        { name: 'plan', kind: 'skill' }
      ])
    ).toEqual([
      { name: 'model', description: 'Host model selector' },
      { name: 'custom' },
      { name: 'skill:' }
    ])
    expect(sessionSlashCommandSuggestions('omp', [])).toEqual([])
  })
})