Feature: A2A architectural boundary enforcement
  As a developer
  I want to verify that the CLI layer does not bypass the A2A boundary
  So that the architecture remains clean and maintainable

  Background:
    Given the source directory exists at "src/cleveragents"

  Scenario: Application layer does not import from CLI (Presentation) layer
    Given the application services directory exists
    When I scan all application service modules for CLI imports
    Then no application service module should import from "cleveragents.cli"

  Scenario: plan_apply_service uses shared output_format instead of CLI formatting
    Given the plan_apply_service module exists
    When I inspect plan_apply_service imports
    Then it should not import from "cleveragents.cli.formatting"
    And it should import from "cleveragents.shared.output_format"

  Scenario: shared output_format module has no CLI dependencies
    Given the shared output_format module exists
    When I inspect shared output_format imports
    Then it should not import from "cleveragents.cli"

  Scenario: format_data function handles JSON format
    Given the shared output_format module is imported
    When I call format_data with a dict and format "json"
    Then the result should be valid JSON
    And the result should contain the expected keys

  Scenario: format_data function handles YAML format
    Given the shared output_format module is imported
    When I call format_data with a dict and format "yaml"
    Then the result should be valid YAML

  Scenario: format_data function handles plain format
    Given the shared output_format module is imported
    When I call format_data with a dict and format "plain"
    Then the result should contain key-value pairs

  Scenario: format_data function handles table format
    Given the shared output_format module is imported
    When I call format_data with a list of dicts and format "table"
    Then the result should contain column headers

  Scenario: format_data function falls back to JSON for unknown format
    Given the shared output_format module is imported
    When I call format_data with a dict and format "unknown"
    Then the result should be valid JSON

  Scenario: format_data handles empty list for table format
    Given the shared output_format module is imported
    When I call format_data with an empty list and format "table"
    Then the result should be "(empty)"

  Scenario: format_data handles nested dict values
    Given the shared output_format module is imported
    When I call format_data with a nested dict and format "plain"
    Then the result should contain nested key-value pairs

  Scenario: format_data handles list of dicts in plain format
    Given the shared output_format module is imported
    When I call format_data with a list of dicts and format "plain"
    Then the result should contain multiple entries separated by dashes

  Scenario: format_data handles dict with list values in plain format
    Given the shared output_format module is imported
    When I call format_data with a dict containing list values and format "plain"
    Then the result should contain list items with dash prefix

  Scenario: format_data handles datetime values in JSON format
    Given the shared output_format module is imported
    When I call format_data with a dict containing a datetime value and format "json"
    Then the result should be valid JSON
    And the datetime value should be serialized as ISO string

  Scenario: format_data handles enum values in JSON format
    Given the shared output_format module is imported
    When I call format_data with a dict containing an enum value and format "json"
    Then the result should be valid JSON
    And the enum value should be serialized as its value

  Scenario: format_data handles single dict in table format
    Given the shared output_format module is imported
    When I call format_data with a single dict and format "table"
    Then the result should contain column headers

  Scenario: format_data handles list with dict values in table format
    Given the shared output_format module is imported
    When I call format_data with a list containing dict values and format "table"
    Then the result should contain serialized dict values
