From de265c543bc47abe6db28851bbf05a8f657f8966 Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Fri, 13 Feb 2026 02:09:26 -0800 Subject: [PATCH] feat: implement local/cline.sh (#853) Add Cline agent support on local machine. Combines local provider primitives with Cline installation and OpenRouter credential injection. Features: - npm-based installation of Cline globally - OpenRouter API key injection via OAuth or env var - Persistent env vars in shell config (.zshrc or .bashrc) - Sets OPENAI_BASE_URL to route through OpenRouter Agent: gap-filler-2 Co-authored-by: B (Discovery Team) <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 --- local/cline.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ manifest.json | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100755 local/cline.sh diff --git a/local/cline.sh b/local/cline.sh new file mode 100755 index 00000000..937f71ef --- /dev/null +++ b/local/cline.sh @@ -0,0 +1,68 @@ +#!/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/local/lib/common.sh)" +fi + +log_info "Cline on Local Machine" +echo "" + +ensure_local_ready + +SERVER_NAME=$(get_server_name) +create_server "${SERVER_NAME}" + +log_step "Installing Cline..." +if ! command -v npm &>/dev/null; then + log_error "npm is required but not installed. Please install Node.js and npm first." + exit 1 +fi +npm install -g cline + +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_step "Setting up environment variables..." +# Export env vars for current session +export OPENROUTER_API_KEY="${OPENROUTER_API_KEY}" +export OPENAI_API_KEY="${OPENROUTER_API_KEY}" +export OPENAI_BASE_URL="https://openrouter.ai/api/v1" + +# Persist to shell config +SHELL_CONFIG="" +if [[ -f "${HOME}/.zshrc" ]]; then + SHELL_CONFIG="${HOME}/.zshrc" +elif [[ -f "${HOME}/.bashrc" ]]; then + SHELL_CONFIG="${HOME}/.bashrc" +fi + +if [[ -n "${SHELL_CONFIG}" ]]; then + # Remove old entries if they exist + sed -i.bak '/^export OPENROUTER_API_KEY=/d' "${SHELL_CONFIG}" 2>/dev/null || true + sed -i.bak '/^export OPENAI_API_KEY=/d' "${SHELL_CONFIG}" 2>/dev/null || true + sed -i.bak '/^export OPENAI_BASE_URL=/d' "${SHELL_CONFIG}" 2>/dev/null || true + + # Add new entries + printf '\nexport OPENROUTER_API_KEY="%s"\n' "${OPENROUTER_API_KEY}" >> "${SHELL_CONFIG}" + printf 'export OPENAI_API_KEY="%s"\n' "${OPENROUTER_API_KEY}" >> "${SHELL_CONFIG}" + printf 'export OPENAI_BASE_URL="https://openrouter.ai/api/v1"\n' >> "${SHELL_CONFIG}" + + log_info "Environment variables persisted to ${SHELL_CONFIG}" +fi + +echo "" +log_info "Local machine setup completed successfully!" +echo "" + +log_step "Starting Cline..." +sleep 1 +clear +cline diff --git a/manifest.json b/manifest.json index f48af2c6..08e1bc90 100644 --- a/manifest.json +++ b/manifest.json @@ -1195,7 +1195,7 @@ "local/interpreter": "implemented", "local/gemini": "implemented", "local/amazonq": "missing", - "local/cline": "missing", + "local/cline": "implemented", "local/gptme": "implemented", "local/opencode": "implemented", "local/plandex": "missing",