import { describe, expect, test } from 'bun:test' import type { Command } from '../types/command.js' import { filterCommandsForHeadlessMode } from './headless.js' describe('filterCommandsForHeadlessMode', () => { test('keeps /goal without exposing other local-jsx UI commands', () => { const commands = [ { type: 'local-jsx', supportsNonInteractive: true, name: 'goal', description: 'Set a goal', load: async () => ({ call: async () => null }), }, { type: 'local-jsx', name: 'config', description: 'Open config UI', load: async () => ({ call: async () => null }), }, { type: 'prompt', name: 'review', description: 'Review code', progressMessage: 'reviewing', contentLength: 0, source: 'builtin', getPromptForCommand: async () => [], }, { type: 'prompt', name: 'statusline', description: 'Hidden from print mode', progressMessage: 'checking', contentLength: 0, source: 'builtin', disableNonInteractive: true, getPromptForCommand: async () => [], }, ] satisfies Command[] expect(filterCommandsForHeadlessMode(commands).map(command => command.name)).toEqual([ 'goal', 'review', ]) }) })