Feature: TUI Slash Command Overlay Coverage
  Scenarios exercising uncovered lines in slash_command_overlay.py,
  including the FallbackStatic init/update and the set_commands method.

  Background:
    Given the slash command overlay module is imported

  Scenario: Instantiating SlashCommandOverlay initialises internal text
    When I create a SlashCommandOverlay instance
    Then the overlay internal text should be empty

  Scenario: Calling update on the overlay sets internal text
    Given I have a SlashCommandOverlay instance
    When I call update with "hello world"
    Then the overlay internal text should be "hello world"

  Scenario: set_commands filters matching commands when query is provided
    Given I have a SlashCommandOverlay instance
    When I call set_commands with query "he" and commands "help,history,hello,quit"
    Then the overlay text should contain "/he"
    And the overlay text should contain "  /help"
    And the overlay text should contain "  /hello"
    And the overlay text should not contain "  /history"
    And the overlay text should not contain "  /quit"

  Scenario: set_commands returns all commands when query is empty
    Given I have a SlashCommandOverlay instance
    When I call set_commands with empty query and commands "help,history,quit"
    Then the overlay text should contain "/"
    And the overlay text should contain "  /help"
    And the overlay text should contain "  /history"
    And the overlay text should contain "  /quit"

  Scenario: set_commands shows no-commands message when nothing matches
    Given I have a SlashCommandOverlay instance
    When I call set_commands with query "zzz" and commands "help,history,quit"
    Then the overlay text should contain "/zzz"
    And the overlay text should contain "  (no commands)"

  Scenario: set_commands truncates to at most twelve command entries
    Given I have a SlashCommandOverlay instance
    When I call set_commands with query "" and 15 commands prefixed with "cmd"
    Then the overlay text should have exactly 13 lines
    And the overlay text should not contain "  /cmd13"

  Scenario: FallbackStatic class is returned when textual import fails
    When I force the fallback static base to load
    Then the fallback class should be usable as a standalone object
    And calling update on the fallback instance should store the text

  @tdd_issue @tdd_issue_4294 @tdd_expected_fail
  Scenario: set_commands renders descriptions alongside command names
    Given I have a SlashCommandOverlay instance
    When I call set_commands with query "" and commands "session:create,session:list"
    Then the overlay text should contain "  /session:create"
    And the overlay text should contain "Desc for session:create"
    And the overlay text should contain "  /session:list"
    And the overlay text should contain "Desc for session:list"
