92df3e1844
* feat(cli): migrate command handling to CommandManager and enhance UI interactions * feat(cli): add /clear and /help commands to enhance user experience * feat(cli): implement /new and /resume commands with interactive session management * Refactor MCP and Skills Command Handling - Moved the interactive picker style to a centralized widget for consistency across MCP and Skills commands. - Updated the MCP command to remove the old command dispatch logic, delegating to the new InstallMCPCommand. - Enhanced the Skills command to utilize a new interactive picker for skill selection, improving user experience. - Implemented cancellation handling in the picker to differentiate between user cancellations and empty selections. - Added comprehensive tests for the new command structures and picker functionalities to ensure reliability. * refactor(cli): streamline CommandManager dispatch and remove deprecated command set * refactor(cli): enhance error handling and state management in ChannelCommand and RichCLICommandUI * refactor(cli): update lifecycle callback terminology and improve async prompt handling in RichCLICommandUI * refactor(cli): enhance SlashCommandCompleter to dynamically fetch workspace directory for autocompletion * refactor(cli): unify quit handling in RichCLICommandUI with shared _stop helper * refactor(cli): remove hardcoded slash commands and utilize command manager for dynamic completion * refactor(cli): update MCP and skills command files for improved clarity and organization * refactor(mcp_ui): remove unnecessary newline in _show_mcp_config function
30 lines
952 B
Python
30 lines
952 B
Python
"""Tests for the /exit command (ExitCommand → ctx.ui.force_quit)."""
|
|
|
|
from unittest.mock import MagicMock
|
|
|
|
from tests.conftest import run_async as _run
|
|
|
|
|
|
class TestExitCommand:
|
|
def test_execute_calls_force_quit(self):
|
|
from EvoScientist.commands.base import CommandContext
|
|
from EvoScientist.commands.implementation.session import ExitCommand
|
|
|
|
ui = MagicMock()
|
|
ctx = CommandContext(
|
|
agent=None,
|
|
thread_id="tid",
|
|
ui=ui,
|
|
)
|
|
cmd = ExitCommand()
|
|
_run(cmd.execute(ctx, []))
|
|
ui.force_quit.assert_called_once()
|
|
|
|
def test_aliases_registered(self):
|
|
"""/quit and /q resolve to the same ExitCommand as /exit."""
|
|
from EvoScientist.commands.manager import manager
|
|
|
|
assert manager.get_command("/exit").name == "/exit"
|
|
assert manager.get_command("/quit").name == "/exit"
|
|
assert manager.get_command("/q").name == "/exit"
|