Feature: Config CLI scope coverage (cfcov3)
  Supplementary scenarios targeting uncovered lines 224-229 and 252-259
  in cleveragents/cli/commands/config.py — the --scope flag handling
  in the config_set command.

  Background:
    Given a cfcov3 isolated temp config directory

  # ── Lines 224-229: invalid scope raises typer.BadParameter ──────────

  Scenario: config set with invalid --scope raises BadParameter
    When I invoke cfcov3 config set "plan.concurrency" "8" with scope "invalid"
    Then the cfcov3 CLI result should have a non-zero exit code
    And the cfcov3 CLI output should contain "Invalid scope"

  # ── Lines 252-253, 258-259: --scope global branch ───────────────────

  Scenario: config set with --scope global writes via set_value
    When I invoke cfcov3 config set "plan.concurrency" "16" with scope "global"
    Then the cfcov3 CLI result should have exit code 0
    And the cfcov3 CLI output should contain "plan.concurrency"
    And the cfcov3 CLI output should contain "global"

  # ── Lines 254-255, 258-259: --scope project branch ─────────────────

  Scenario: config set with --scope project writes via set_value
    When I invoke cfcov3 config set "plan.concurrency" "12" with scope "project"
    Then the cfcov3 CLI result should have exit code 0
    And the cfcov3 CLI output should contain "plan.concurrency"
    And the cfcov3 CLI output should contain "project"

  # ── Lines 257-259: --scope local branch ─────────────────────────────

  Scenario: config set with --scope local writes via set_value
    When I invoke cfcov3 config set "plan.concurrency" "20" with scope "local"
    Then the cfcov3 CLI result should have exit code 0
    And the cfcov3 CLI output should contain "plan.concurrency"
    And the cfcov3 CLI output should contain "local"

  # ── Lines 252-253 with pre-existing global value ────────────────────

  Scenario: config set --scope global shows previous value from config_data
    Given the cfcov3 global config has "plan.concurrency" set to 4
    When I invoke cfcov3 config set "plan.concurrency" "99" with scope "global"
    Then the cfcov3 CLI result should have exit code 0
    And the cfcov3 set_value mock should have been called with scope GLOBAL

  # ── Lines 254-255 reading previous from project config ──────────────

  Scenario: config set --scope project reads previous from project config
    Given the cfcov3 project config returns "plan.concurrency" as 7
    When I invoke cfcov3 config set "plan.concurrency" "14" with scope "project"
    Then the cfcov3 CLI result should have exit code 0
    And the cfcov3 read_project_config mock should have been called

  # ── Lines 257-259 reading previous from local config ────────────────

  Scenario: config set --scope local reads previous from local config
    Given the cfcov3 local config returns "plan.concurrency" as 3
    When I invoke cfcov3 config set "plan.concurrency" "30" with scope "local"
    Then the cfcov3 CLI result should have exit code 0
    And the cfcov3 read_local_config mock should have been called
