CodeGuard/setup-opencode-config.sh

37 lines
1.1 KiB
Bash

#!/bin/bash
echo "Setting up OpenCode configuration..."
OPENCODE_DIR="$HOME/.config/opencode"
if [ ! -d "$OPENCODE_DIR" ]; then
echo "Creating opencode config directory..."
mkdir -p "$OPENCODE_DIR"
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SOURCE_CONFIG="$SCRIPT_DIR/installations/opencode-cli/opencode.json"
if [ -f "$SOURCE_CONFIG" ]; then
echo "Copying opencode.json to $OPENCODE_DIR..."
cp -f "$SOURCE_CONFIG" "$OPENCODE_DIR/opencode.json"
echo "Configuration copied successfully!"
else
echo "Error: Source config not found at $SOURCE_CONFIG"
exit 1
fi
echo ""
echo "Setting environment for offline mode..."
export OPENCODE_OFFLINE=1
echo "export OPENCODE_OFFLINE=1" >> ~/.bashrc
echo "Environment variable set: OPENCODE_OFFLINE=1"
echo ""
echo "========================================"
echo " Offline Mode Enabled!"
echo "========================================"
echo ""
echo "This hides OpenCode Zen models and uses local model only."
echo "OpenCode is ready to use with local model!"
echo ""
echo "Note: Make sure your local model service (e.g., vLLM) is running."