mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-25 14:54:50 +00:00
Adds Continue CLI support on Fly.io by combining Fly.io's Machines API primitives with Continue's setup steps. Includes OpenRouter config injection via ~/.continue/config.json. Agent: gap-filler-fly-continue Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
58 lines
1.4 KiB
Bash
58 lines
1.4 KiB
Bash
#!/bin/bash
|
|
set -eo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)"
|
|
if [[ -n "$SCRIPT_DIR" && -f "$SCRIPT_DIR/lib/common.sh" ]]; then
|
|
source "$SCRIPT_DIR/lib/common.sh"
|
|
else
|
|
eval "$(curl -fsSL https://raw.githubusercontent.com/OpenRouterTeam/spawn/main/fly/lib/common.sh)"
|
|
fi
|
|
|
|
log_info "Continue on Fly.io"
|
|
echo ""
|
|
|
|
ensure_fly_cli
|
|
ensure_fly_token
|
|
|
|
SERVER_NAME=$(get_server_name)
|
|
create_server "${SERVER_NAME}"
|
|
wait_for_cloud_init
|
|
|
|
log_warn "Installing Continue CLI..."
|
|
run_server "npm install -g @continuedev/cli"
|
|
|
|
echo ""
|
|
if [[ -n "${OPENROUTER_API_KEY:-}" ]]; then
|
|
log_info "Using OpenRouter API key from environment"
|
|
else
|
|
OPENROUTER_API_KEY=$(get_openrouter_api_key_oauth 5180)
|
|
fi
|
|
|
|
log_warn "Setting up environment variables..."
|
|
inject_env_vars_fly \
|
|
"OPENROUTER_API_KEY=${OPENROUTER_API_KEY}"
|
|
|
|
log_warn "Creating Continue config file..."
|
|
run_server "mkdir -p ~/.continue"
|
|
run_server "cat > ~/.continue/config.json << 'EOF'
|
|
{
|
|
\"models\": [
|
|
{
|
|
\"title\": \"OpenRouter\",
|
|
\"provider\": \"openrouter\",
|
|
\"model\": \"openrouter/auto\",
|
|
\"apiBase\": \"https://openrouter.ai/api/v1\",
|
|
\"apiKey\": \"${OPENROUTER_API_KEY}\"
|
|
}
|
|
]
|
|
}
|
|
EOF"
|
|
|
|
echo ""
|
|
log_info "Fly.io setup completed successfully!"
|
|
echo ""
|
|
|
|
log_warn "Starting Continue CLI in TUI mode..."
|
|
sleep 1
|
|
clear
|
|
interactive_session "source ~/.zshrc && cn"
|