mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-06-01 14:30:27 +00:00
Created helper functions in shared/common.sh to simplify ensure_ssh_key(): - generate_ssh_key_if_missing(key_path): Generate SSH key if needed - get_ssh_fingerprint(pub_path): Get MD5 fingerprint - json_escape(string): JSON-escape strings for API bodies Refactored ensure_ssh_key() in all cloud providers to use these helpers: - Reduced function length from 35-52 lines to 24-28 lines - Eliminated nested conditionals - Made the code flow more linear and readable - Centralized SSH key generation and fingerprint logic Benefits: - Single source of truth for SSH key operations - Reduced code duplication (~40 lines per provider → 3 helper functions) - Easier to maintain and test - More consistent error handling All tests pass (42/42). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| common.sh | ||