mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
refactor(opencode): reload config in place and drop v1 compatibility shims
Route config/skill/AGENTS.md changes through the OpenCode location reload API instead of a full server restart, stop auto-resuming interrupted sessions, remove the restart coordinator and v1 MCP/version shims, and pin support to OpenCode >=2.0.15 <3.0.0. Adds integration-ready retries, service-mode launch, ocm-cli repo proxy, and new frontend form/MCP helpers.
This commit is contained in:
1 parent
7351d5f002
commit
f5d0f0c27e
171 files changed
+5046
-11437
No files matched your search
@@ -42,12 +42,24 @@ grant_kvm_access() {
|
||||
echo "Granted node access to $dev (group '$group_name', gid $dev_gid)"
|
||||
}
|
||||
|
||||
MIN_OPENCODE_VERSION="2.0.0"
|
||||
OPENCODE_SUPPORTED_FLOOR="${OPENCODE_BUNDLED_VERSION:-}"
|
||||
|
||||
version_gte() {
|
||||
printf '%s\n%s\n' "$2" "$1" | sort -V -C
|
||||
}
|
||||
|
||||
is_supported_opencode_version() {
|
||||
local version="$1"
|
||||
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || return 1
|
||||
[ -n "$OPENCODE_SUPPORTED_FLOOR" ] || return 1
|
||||
[ "${version%%.*}" = "${OPENCODE_SUPPORTED_FLOOR%%.*}" ] || return 1
|
||||
version_gte "$version" "$OPENCODE_SUPPORTED_FLOOR"
|
||||
}
|
||||
|
||||
supported_opencode_range() {
|
||||
printf '>=%s <%s.0.0\n' "$OPENCODE_SUPPORTED_FLOOR" "$(( ${OPENCODE_SUPPORTED_FLOOR%%.*} + 1 ))"
|
||||
}
|
||||
|
||||
read_opencode_version() {
|
||||
local binary
|
||||
binary="$(command -v "${1:-opencode}" 2>/dev/null || true)"
|
||||
@@ -76,10 +88,6 @@ install_opencode() {
|
||||
echo "ERROR: OPENCODE_BUNDLED_VERSION='$opencode_version' is not an X.Y.Z version; refusing to download it" >&2
|
||||
return 1
|
||||
fi
|
||||
if ! version_gte "$opencode_version" "$MIN_OPENCODE_VERSION"; then
|
||||
echo "ERROR: OPENCODE_BUNDLED_VERSION=$opencode_version is below the minimum supported $MIN_OPENCODE_VERSION; refusing to download it" >&2
|
||||
return 1
|
||||
fi
|
||||
echo "Installing OpenCode ${opencode_version}..."
|
||||
local staging
|
||||
staging="$(mktemp -d)"
|
||||
@@ -102,8 +110,8 @@ reconcile_persisted_opencode() {
|
||||
rm -f "$persisted_path"
|
||||
return 0
|
||||
fi
|
||||
if ! version_gte "$persisted_version" "$MIN_OPENCODE_VERSION"; then
|
||||
echo "Persisted OpenCode $persisted_version is below the minimum supported $MIN_OPENCODE_VERSION; removing it so the bundled OpenCode 2 binary is used"
|
||||
if ! is_supported_opencode_version "$persisted_version"; then
|
||||
echo "Persisted OpenCode $persisted_version is outside the supported range $(supported_opencode_range); removing it so the bundled OpenCode $OPENCODE_SUPPORTED_FLOOR binary is used"
|
||||
rm -f "$persisted_path"
|
||||
return 0
|
||||
fi
|
||||
@@ -147,10 +155,10 @@ OPENCODE_VERSION="$(read_opencode_version)"
|
||||
echo "OpenCode is installed (version: $OPENCODE_VERSION)"
|
||||
|
||||
if [ "$OPENCODE_VERSION" != "unknown" ]; then
|
||||
if version_gte "$OPENCODE_VERSION" "$MIN_OPENCODE_VERSION"; then
|
||||
echo "OpenCode version meets minimum requirement (>=$MIN_OPENCODE_VERSION)"
|
||||
if is_supported_opencode_version "$OPENCODE_VERSION"; then
|
||||
echo "OpenCode version is within the supported range $(supported_opencode_range)"
|
||||
else
|
||||
echo "OpenCode version $OPENCODE_VERSION is below minimum required version $MIN_OPENCODE_VERSION"
|
||||
echo "OpenCode version $OPENCODE_VERSION is outside the supported range $(supported_opencode_range)"
|
||||
echo "Reinstalling bundled OpenCode version ${OPENCODE_BUNDLED_VERSION}..."
|
||||
install_opencode
|
||||
|
||||
|
||||
Executable → Regular
+7
-2
@@ -36,10 +36,15 @@ if ! opencode --version &> /dev/null; then
|
||||
exit 1
|
||||
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%%.*}"
|
||||
OPENCODE_VERSION="$(opencode --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)"
|
||||
|
||||
if ! printf '%s\n%s\n' "2.0.0" "$OPENCODE_VERSION" | sort -V -C; then
|
||||
echo "❌ OpenCode 2.0.0 or newer is required. Please upgrade it with:"
|
||||
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:"
|
||||
echo " curl -fsSL https://opencode.ai/v2/install | bash"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user