spawn/hetzner
Sprite f2afdea792 refactor: extract ensure_ssh_key duplication to shared library (~220 lines)
Eliminates duplicate SSH key registration logic across 5 cloud providers
(Hetzner, DigitalOcean, Vultr, Linode, Lambda) by introducing a generic
callback-based pattern in shared/common.sh.

Before: Each provider had ~45 lines of nearly identical code for:
- Generating SSH keys if missing
- Getting fingerprints
- Checking if key exists with provider
- Registering key if not exists
- Error handling

After: Providers implement 2 simple callbacks:
- check_callback: provider-specific API call to check if key exists
- register_callback: provider-specific API call to register key

The shared function handles:
- Key generation (via generate_ssh_key_if_missing)
- Fingerprint extraction (via get_ssh_fingerprint)
- Flow control and logging
- Callback orchestration

Changes:
- shared/common.sh: Added ensure_ssh_key_with_provider() function
- hetzner/lib/common.sh: Refactored to use callbacks
- digitalocean/lib/common.sh: Refactored to use callbacks
- vultr/lib/common.sh: Refactored to use callbacks
- linode/lib/common.sh: Refactored to use callbacks
- lambda/lib/common.sh: Refactored to use callbacks

Benefits:
- DRY: Eliminates ~220 lines of duplicate code
- Maintainability: Bug fixes in registration flow benefit all providers
- Consistency: All providers use identical registration logic
- Extensibility: New providers can reuse this pattern

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 01:33:06 +00:00
..
lib refactor: extract ensure_ssh_key duplication to shared library (~220 lines) 2026-02-08 01:33:06 +00:00
aider.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
amazonq.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
claude.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
cline.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
codex.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
gemini.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
goose.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
interpreter.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
nanoclaw.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
openclaw.sh Use ${VAR:-} for all optional env var checks (#28) 2026-02-07 16:28:12 -08:00
README.md Add E2B + Modal sandbox providers, restructure README (#22) 2026-02-07 14:11:04 -08:00

Hetzner Cloud

Hetzner Cloud servers via REST API. Hetzner Cloud

Agents

Claude Code

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/claude.sh)

OpenClaw

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/openclaw.sh)

NanoClaw

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/nanoclaw.sh)

Aider

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/aider.sh)

Goose

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/goose.sh)

Codex CLI

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/codex.sh)

Open Interpreter

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/interpreter.sh)

Gemini CLI

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/gemini.sh)

Amazon Q CLI

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/amazonq.sh)

Cline

bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/cline.sh)

Non-Interactive Mode

HETZNER_SERVER_NAME=dev-mk1 \
HCLOUD_TOKEN=your-token \
OPENROUTER_API_KEY=sk-or-v1-xxxxx \
  bash <(curl -fsSL https://openrouter.ai/lab/spawn/hetzner/claude.sh)