@tdd_issue @tdd_issue_2604
Feature: TDD Issue #2604 — Incomplete subcommand registration on error
  As a CLI user
  I want the CLI to fail loudly when subcommand registration encounters an error
  So that the CLI is never left in a partially initialized state

  This test captures bug #2604. The _register_subcommands() function in
  src/cleveragents/cli/main.py catches all exceptions during subcommand
  import and registration, prints a traceback, then silently returns.
  This violates CONTRIBUTING.md error-handling standards: "Errors must
  never be suppressed. Exceptions should propagate to the top-level
  execution handler."

  The fix replaces the bare `return` with `raise SystemExit(1)` so the
  CLI exits with a non-zero exit code instead of entering a partially
  initialized state.

  @tdd_issue @tdd_issue_4277 @tdd_expected_fail
  Scenario: Bug #2604 — subcommand registration failure exits with non-zero code
    Given the CLI subcommand import raises an ImportError during registration
    When the CLI is invoked with any command
    Then the CLI exits with a non-zero exit code

  @tdd_issue @tdd_issue_4277 @tdd_expected_fail
  Scenario: Bug #2604 — subcommand registration failure prints error message
    Given the CLI subcommand import raises an ImportError during registration
    When the CLI is invoked with any command
    Then the error output contains "Failed to register subcommands"

  @tdd_expected_fail
  Scenario: Bug #2604 — old behaviour silently returns on registration error
    Given the CLI subcommand import raises an ImportError during registration
    When the CLI is invoked with any command
    Then the CLI exits with exit code 0
