CodeGuard/setup-opencode-config.sh

37 lines
1.1 KiB
Bash
Raw Normal View History

2026-03-16 10:45:15 +08:00
#!/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 ""
2026-03-16 15:14:04 +08:00
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."
2026-03-16 10:45:15 +08:00
echo "OpenCode is ready to use with local model!"
echo ""
2026-03-16 15:14:04 +08:00
echo "Note: Make sure your local model service (e.g., vLLM) is running."