#!/usr/bin/env bash set -euo pipefail echo "==========================================" echo " JimuAI OpenCode One-Click Setup" echo "==========================================" echo echo "This script will:" echo "1. Check Node.js / npm" echo "2. Install OpenCode" echo "3. Write Codex / Claude / Gemini config" echo echo "[1/3] Checking environment..." node -v >/dev/null 2>&1 npm -v >/dev/null 2>&1 echo if ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then echo "[ERROR] Node.js / npm not found. Please install Node.js 16+ first." exit 1 fi echo "[2/3] Installing OpenCode..." npm install -g opencode-ai echo read -r -p "Paste your Codex API Key (sk-...) and press Enter: " JIMU_CODEX_KEY read -r -p "Paste your Claude API Key (sk-...) and press Enter: " JIMU_CLAUDE_KEY read -r -p "Paste your Gemini API Key (sk-...) and press Enter: " JIMU_GEMINI_KEY if [ -z "${JIMU_CODEX_KEY:-}" ] || [ -z "${JIMU_CLAUDE_KEY:-}" ] || [ -z "${JIMU_GEMINI_KEY:-}" ]; then echo "[ERROR] Codex / Claude / Gemini Key are all required." exit 1 fi echo echo "[3/3] Writing OpenCode config..." curl -fsSL https://code.jimuxyz.com/env_deploy/opencode-deploy.sh | bash -s -- "$JIMU_CODEX_KEY" "$JIMU_CLAUDE_KEY" "$JIMU_GEMINI_KEY" echo echo "==========================================" echo "Setup finished." echo "You can now open a new terminal and run:" echo " opencode" echo "==========================================" echo read -r -p "Press Enter to close..."