spawn/hetzner/opencode.sh
A 966f56e813
feat: convert hetzner/ cloud provider from Bash to TypeScript (#1689)
* feat: convert hetzner/ cloud provider from Bash to TypeScript

Migrates hetzner/ to the same TypeScript pattern as fly/ and local/:
- Creates cli/src/hetzner/{main.ts,hetzner.ts,agents.ts}
- Replaces 6 bash agent scripts with thin bun shims
- Reuses cli/src/fly/{oauth.ts,ui.ts} for cross-cloud functionality
- Adds hetzner to TS_CLOUDS in manifest-integrity tests
- Bumps CLI version to 0.5.35

Why: Consistent TypeScript architecture across cloud providers enables
type-safe API interactions, better error handling for Hetzner's unusual
"error: null" success response format, and eliminates bash JSON parsing.

Fixes #1676

Agent: code-health
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: validate remotePath in uploadConfigFile to prevent command injection

Agent: security-auditor
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 03:49:26 -08:00

19 lines
648 B
Bash
Executable file

#!/bin/bash
set -eo pipefail
_ensure_bun() {
if command -v bun &>/dev/null; then return 0; fi
curl -fsSL https://bun.sh/install | bash >/dev/null 2>&1
export PATH="$HOME/.bun/bin:$PATH"
}
_ensure_bun
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
if [[ -n "$SCRIPT_DIR" && -f "$SCRIPT_DIR/../cli/src/hetzner/main.ts" ]]; then
exec bun run "$SCRIPT_DIR/../cli/src/hetzner/main.ts" opencode "$@"
fi
HETZNER_JS=$(mktemp)
trap 'rm -f "$HETZNER_JS"' EXIT
curl -fsSL "https://github.com/OpenRouterTeam/spawn/releases/download/hetzner-latest/hetzner.js" -o "$HETZNER_JS"
exec bun run "$HETZNER_JS" opencode "$@"