Feature: Consolidated Main Modules
  Combined scenarios from: main_module, modules, scripts

  # ============================================================
  # Originally from: main_module.feature
  # Feature: Main Module Entry Point
  # ============================================================

  Scenario: Run function returns success code
    Given the CLI main function will return 0
    When I call the run function
    Then the run function should return 0


  Scenario: Run function returns error code
    Given the CLI main function will return 1
    When I call the run function
    Then the run function should return 1


  Scenario: Run function handles exceptions
    Given the CLI main function will raise an exception
    When I call the run function expecting an exception
    Then an exception should be raised


  Scenario: Module has required attributes
    When I import the __main__ module
    Then the module should have a "run" attribute
    And the "run" attribute should be callable

  # ============================================================
  # Originally from: modules.feature
  # Feature: Module Entry Points
  # ============================================================

  Scenario: Run main module
    When I execute the __main__ module
    Then the CLI should start


  Scenario: Import main module
    When I import the __main__ module
    Then it should have a run function


  Scenario: Platform module imports CLI
    When I call ensure_cli_importable
    Then it should return the CLI module
    And the module should have a cli attribute
    And the module should have a main attribute


  Scenario: Platform handles already imported module
    When the CLI module is already imported
    And I call ensure_cli_importable
    Then it should return the cached module


  Scenario: Platform handles import errors
    When the CLI module import fails
    And I call ensure_cli_importable
    Then it should propagate the import error

  # ============================================================
  # Originally from: scripts.feature
  # Feature: Scripts functionality
  # ============================================================

  Scenario: Do-something shell script executes
    Given I have the do-something.sh script
    When I execute the do-something.sh script
    Then the script output should contain "This script does a thing"
