Feature: Plan prompt command
  As a CleverAgents user
  I want to provide guidance to an executing plan
  So that the plan can continue with human-in-the-loop input

  Scenario: Plan prompt command is discoverable in help
    When I run plan command help
    Then help output should include plan prompt command

  @tdd_issue @tdd_issue_4255
  Scenario: Plan prompt delivers guidance and returns spec envelope in json
    Given a mocked lifecycle service prompt response
    When I run plan prompt with plan id "01HXM8C2ZK4Q7C2B3F2R4VYV6J" and guidance "Use mocks for database tests" in format "json"
    Then the prompt command should succeed
    And lifecycle prompt should be called with plan id "01HXM8C2ZK4Q7C2B3F2R4VYV6J" and guidance "Use mocks for database tests"
    And prompt output envelope should contain command "plan prompt"
    And prompt output envelope should contain status "ok"
    And prompt output data should include queued guidance

  Scenario Outline: Plan prompt renders successfully across output formats
    Given a mocked lifecycle service prompt response
    When I run plan prompt with plan id "01HXM8C2ZK4Q7C2B3F2R4VYV6J" and guidance "Use mocks for database tests" in format "<format>"
    Then the prompt command should succeed
    And prompt output should include guidance text "Use mocks for database tests"

    Examples:
      | format |
      | rich   |
      | color  |
      | table  |
      | plain  |
      | json   |
      | yaml   |

  Scenario: Plan prompt aborts when plan is not in active execute phase
    Given lifecycle service rejects prompt for inactive plan phase
    When I run plan prompt with plan id "01HXM8C2ZK4Q7C2B3F2R4VYV6J" and guidance "Use mocks for database tests" in format "json"
    Then the prompt command should abort
    And prompt output should mention inactive execute phase

  Scenario: A2A facade routes _cleveragents plan prompt to lifecycle service
    Given an A2A facade with a lifecycle prompt service
    When I dispatch _cleveragents plan prompt for plan "01HXM8C2ZK4Q7C2B3F2R4VYV6J" and guidance "Use mocks for database tests"
    Then facade prompt response should not be a stub
    And facade prompt response should contain plan id "01HXM8C2ZK4Q7C2B3F2R4VYV6J"
    And facade prompt response should contain guidance "Use mocks for database tests"
