From a873d26a67ee553dc142b01b7b7b193eccd91acc Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Tue, 10 Feb 2026 15:27:47 -0800 Subject: [PATCH] feat: Add opencode on FluidStack (#288) Agent: gap-filler Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 --- fluidstack/opencode.sh | 58 ++++++++++++++++++++++++++++++++++++++++++ manifest.json | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 fluidstack/opencode.sh diff --git a/fluidstack/opencode.sh b/fluidstack/opencode.sh new file mode 100644 index 00000000..646bd252 --- /dev/null +++ b/fluidstack/opencode.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# shellcheck disable=SC2154 +set -eo pipefail + +# Source common functions - try local file first, fall back to remote +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)" +# shellcheck source=fluidstack/lib/common.sh +if [[ -f "${SCRIPT_DIR}/lib/common.sh" ]]; then + source "${SCRIPT_DIR}/lib/common.sh" +else + eval "$(curl -fsSL https://raw.githubusercontent.com/OpenRouterTeam/spawn/main/fluidstack/lib/common.sh)" +fi + +log_info "OpenCode on FluidStack" +echo "" + +# 1. Ensure FluidStack API key is configured +ensure_fluidstack_token + +# 2. Generate + register SSH key +ensure_ssh_key + +# 3. Get instance name and create instance +SERVER_NAME=$(get_server_name) +create_server "${SERVER_NAME}" + +# 4. Wait for SSH connectivity and install base tools +verify_server_connectivity +install_base_tools + +# 5. Install OpenCode +log_warn "Installing OpenCode..." +run_server "${FLUIDSTACK_SERVER_IP}" "$(opencode_install_cmd)" +log_info "OpenCode installed" + +# 6. Get OpenRouter API key +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 + +# 7. Inject environment variables +log_warn "Setting up environment variables..." +inject_env_vars_ssh "${FLUIDSTACK_SERVER_IP}" upload_file run_server \ + "OPENROUTER_API_KEY=${OPENROUTER_API_KEY}" + +echo "" +log_info "FluidStack instance setup completed successfully!" +log_info "Instance: ${SERVER_NAME} (IP: ${FLUIDSTACK_SERVER_IP})" +echo "" + +# 8. Start OpenCode interactively +log_warn "Starting OpenCode..." +sleep 1 +clear +interactive_session "${FLUIDSTACK_SERVER_IP}" "source ~/.zshrc && opencode" diff --git a/manifest.json b/manifest.json index bd93e588..0b8a42d6 100644 --- a/manifest.json +++ b/manifest.json @@ -841,7 +841,7 @@ "fluidstack/amazonq": "implemented", "fluidstack/cline": "implemented", "fluidstack/gptme": "implemented", - "fluidstack/opencode": "missing", + "fluidstack/opencode": "implemented", "fluidstack/plandex": "missing", "fluidstack/kilocode": "missing", "civo/claude": "implemented",