spawn/shared
A 9576cd5005
refactor: reduce function complexity in shared/common.sh and cli/commands.ts (#1138)
Extracted helper functions to improve code maintainability:

1. shared/common.sh:
   - Extracted _prompt_and_validate_api_key() from get_openrouter_api_key_manual()
   - Simplified API key validation loop and confirmation logic

2. cli/commands.ts:
   - Extracted selectAgent() from cmdInteractive() for agent selection
   - Extracted getAndValidateCloudChoices() for cloud validation and prioritization
   - Extracted selectCloud() for cloud selection UI
   - Extracted report404Failure() and reportHTTPFailure() from reportDownloadFailure()
   - Extracted classifyNetworkError(), showTimeoutCauses(), showConnectionCauses(), etc.
   - Simplified error handling with switch statement in reportDownloadError()

These changes reduce cyclomatic complexity and improve testability while preserving
all existing functionality.

Co-authored-by: spawn-refactor-bot <refactor@openrouter.ai>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 18:11:36 -05:00
..
common.sh refactor: reduce function complexity in shared/common.sh and cli/commands.ts (#1138) 2026-02-14 18:11:36 -05:00
github-auth.sh refactor: decompose ensure_jq and ensure_gh_cli into focused helpers (#994) 2026-02-13 12:14:56 -08:00
key-request.sh fix: Properly handle comma-separated auth vars in key-request.sh (#1083) 2026-02-14 05:10:11 -05:00