refactor(opencode): consolidate v2 migration helpers and harden install, proxy, and session flows

- extract shared semver and model-ref utilities, reuse across version checks
- share the OpenCode release download script across Docker, entrypoint, dev setup
- unify install/upgrade failure recovery and guard externally managed OPENCODE_BIN
- scope the repo proxy location rewrite and surface ocm proxy errors
- rework frontend session projection, permission lookup, and cache invalidation
This commit is contained in:
Chris Scott committed 2026-09-25 18:07:30 -04:00
1 parent f5d0f0c27e
commit 5593163099
115 files changed
+3027 -1204

No files matched your search

+4 -6
View File
@@ -37,14 +37,12 @@ if ! opencode --version &> /dev/null; then
fi
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
OPENCODE_PINNED_VERSION="$(sed -n 's/^ARG OPENCODE_VERSION=//p' "$REPO_ROOT/Dockerfile" | head -1)"
OPENCODE_PINNED_MAJOR="${OPENCODE_PINNED_VERSION%%.*}"
source "$REPO_ROOT/scripts/lib/opencode-release.sh"
OPENCODE_SUPPORTED_FLOOR="$(sed -n 's/^ARG OPENCODE_VERSION=//p' "$REPO_ROOT/Dockerfile" | head -1)"
OPENCODE_VERSION="$(opencode --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)"
if [ -z "$OPENCODE_PINNED_VERSION" ] \
|| [ "${OPENCODE_VERSION%%.*}" != "$OPENCODE_PINNED_MAJOR" ] \
|| ! printf '%s\n%s\n' "$OPENCODE_PINNED_VERSION" "$OPENCODE_VERSION" | sort -V -C; then
echo "❌ OpenCode ${OPENCODE_VERSION:-unknown} is not supported; OpenCode >=${OPENCODE_PINNED_VERSION} <$((OPENCODE_PINNED_MAJOR + 1)).0.0 is required. Please install it with:"
if [ -z "$OPENCODE_SUPPORTED_FLOOR" ] || ! is_supported_opencode_version "$OPENCODE_VERSION"; then
echo "❌ OpenCode ${OPENCODE_VERSION:-unknown} is not supported; OpenCode $(supported_opencode_range) is required. Please install it with:"
echo " curl -fsSL https://opencode.ai/v2/install | bash"
exit 1
fi