mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
feat(opencode): migrate OpenCode Manager to OpenCode 2
Port the backend lifecycle, generated plugins, event aggregation, schedules, worktrees, provider credentials, MCP, config handling, the frontend chat model, and the ocm CLI to OpenCode 2. Adopt @opencode/client 2.0.15 as the single typed V2 API contract, require OpenCode 2.0.0 or newer (pinned 2.0.15), and delete every V1-only code path.
This commit is contained in:
1 parent
6c2ebd764b
commit
7351d5f002
313 files changed
+23848
-36801
No files matched your search
@@ -42,7 +42,7 @@ grant_kvm_access() {
|
||||
echo "Granted node access to $dev (group '$group_name', gid $dev_gid)"
|
||||
}
|
||||
|
||||
MIN_OPENCODE_VERSION="1.0.137"
|
||||
MIN_OPENCODE_VERSION="2.0.0"
|
||||
|
||||
version_gte() {
|
||||
printf '%s\n%s\n' "$2" "$1" | sort -V -C
|
||||
@@ -57,6 +57,15 @@ read_opencode_version() {
|
||||
runuser -u node -- "$binary" --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true
|
||||
}
|
||||
|
||||
opencode_arch_suffix() {
|
||||
local arch
|
||||
arch="$(uname -m | sed 's/x86_64/x64/; s/aarch64/arm64/')"
|
||||
if ls /lib/ld-musl-* >/dev/null 2>&1; then
|
||||
arch="${arch}-musl"
|
||||
fi
|
||||
printf '%s\n' "$arch"
|
||||
}
|
||||
|
||||
install_opencode() {
|
||||
local opencode_version="${OPENCODE_BUNDLED_VERSION:-}"
|
||||
if [ -z "$opencode_version" ]; then
|
||||
@@ -74,7 +83,7 @@ install_opencode() {
|
||||
echo "Installing OpenCode ${opencode_version}..."
|
||||
local staging
|
||||
staging="$(mktemp -d)"
|
||||
curl -fsSL "https://github.com/anomalyco/opencode/releases/download/v${opencode_version}/opencode-linux-$(uname -m | sed 's/x86_64/x64/; s/aarch64/arm64/').tar.gz" \
|
||||
curl -fsSL "https://opencode.ai/files/bin/${opencode_version}/opencode-linux-$(opencode_arch_suffix).tar.gz" \
|
||||
-o "$staging/opencode.tar.gz"
|
||||
tar -xzf "$staging/opencode.tar.gz" -C "$staging"
|
||||
mkdir -p "$HOME/.opencode/bin"
|
||||
@@ -93,6 +102,11 @@ 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"
|
||||
rm -f "$persisted_path"
|
||||
return 0
|
||||
fi
|
||||
echo "Persisted OpenCode $persisted_version is usable; retaining it"
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user