spawn/cherry/lib
A 4c00f3781e
refactor: Reduce complexity in cherry and contabo cloud libraries (#359)
Cherry Servers (cherry/lib/common.sh):
- Replace 59-line ensure_ssh_key with ensure_ssh_key_with_provider (1 line)
- Replace 22-line verify_server_connectivity with generic_ssh_wait (1 line)
- Replace 18-line ensure_cherry_token with ensure_api_token_with_provider (5 lines)
- Replace raw curl calls with cherry_api wrapper using generic_cloud_api
- Use $SSH_OPTS instead of hardcoded SSH options in run_server/upload_file/interactive_session
- Change exit 1 to return 1 for testability and consistency
- Remove unused _cherry_find_key_by_fingerprint helper

Contabo (contabo/lib/common.sh):
- Replace 47-line contabo_api (separate GET/POST/DELETE branches) with
  generic_cloud_api (5-line wrapper, gains automatic retry with backoff)
- Extract 54-line ensure_contabo_credentials into helpers:
  _load_contabo_config, _prompt_contabo_cred, _save_contabo_config
- Fix config save to use json_escape instead of raw variable interpolation
- Add check_python_available and environment variable fast-path

Net: -73 lines, 2 files changed

Agent: complexity-hunter

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-10 22:49:41 -08:00
..
common.sh refactor: Reduce complexity in cherry and contabo cloud libraries (#359) 2026-02-10 22:49:41 -08:00