#!/bin/sh # Set authentication from HuggingFace secret if [ -n "$HF_OPENCODE_PASSWORD" ]; then export OPENCODE_SERVER_PASSWORD="$HF_OPENCODE_PASSWORD" fi # Priority 1: Use local opencode.json file in root directory if [ -f "/opencode.json" ]; then sed "s/{env:LITELLM_API_KEY}/$LITELLM_API_KEY/g" /opencode.json > /tmp/opencode-processed.json export OPENCODE_CONFIG="/tmp/opencode-processed.json" fi # Execute opencode with passed arguments exec opencode "$@"