Feature: CLI main.py coverage round 3 As a developer I want to cover remaining uncovered lines in cleveragents.cli.main So that code coverage gaps on lines 104-110, 582-590, and 593-594 are closed # ------------------------------------------------------------------- # Lines 104-110: _register_subcommands exception handler # ------------------------------------------------------------------- Scenario: _register_subcommands handles import failure gracefully Given cmcov3 the _subcommands_registered flag is reset to False When cmcov3 _register_subcommands is called and an import raises an error Then cmcov3 the error console should have printed the failure message And cmcov3 the _subcommands_registered flag should still be False # ------------------------------------------------------------------- # Lines 582-586: completion command with subprocess returning stdout # ------------------------------------------------------------------- Scenario: completion command outputs subprocess stdout when present Given cmcov3 subprocess.run is mocked to return stdout "echo hello" When cmcov3 the completion command is invoked with shell "bash" Then cmcov3 the output should contain "echo hello" # ------------------------------------------------------------------- # Lines 587-590: completion command with empty subprocess stdout # ------------------------------------------------------------------- Scenario: completion command outputs placeholder when subprocess has no stdout Given cmcov3 subprocess.run is mocked to return empty stdout When cmcov3 the completion command is invoked with shell "zsh" Then cmcov3 the output should contain "# Completion script for zsh" And cmcov3 the output should contain "# Shell: zsh" # ------------------------------------------------------------------- # Lines 593-594+: convert_exit_code function coverage # ------------------------------------------------------------------- Scenario: convert_exit_code returns 0 for None input When cmcov3 convert_exit_code is called with None Then cmcov3 the exit code result should be 0 Scenario: convert_exit_code extracts exit_code attribute from object When cmcov3 convert_exit_code is called with an object having exit_code 42 Then cmcov3 the exit code result should be 42 Scenario: convert_exit_code clamps large positive code to 255 When cmcov3 convert_exit_code is called with integer 999 Then cmcov3 the exit code result should be 255 Scenario: convert_exit_code passes through negative codes When cmcov3 convert_exit_code is called with integer -1 Then cmcov3 the exit code result should be -1 Scenario: convert_exit_code returns 1 for non-integer string When cmcov3 convert_exit_code is called with a non-convertible value Then cmcov3 the exit code result should be 1 Scenario: convert_exit_code handles zero correctly When cmcov3 convert_exit_code is called with integer 0 Then cmcov3 the exit code result should be 0 Scenario: convert_exit_code handles normal positive code When cmcov3 convert_exit_code is called with integer 7 Then cmcov3 the exit code result should be 7