From 1d078f5eb32e989b5f3dcb218111d434983189b6 Mon Sep 17 00:00:00 2001 From: Pitusiray <45488098+Pitusiray@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:05:48 +0100 Subject: [PATCH 1/8] Update install.ps1 to include OpenCode support --- install.ps1 | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 3 deletions(-) diff --git a/install.ps1 b/install.ps1 index e4b4ab67..aefc6e4c 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,7 +1,7 @@ # # Databricks AI Dev Kit - Unified Installer (Windows) # -# Installs skills, MCP server, and configuration for Claude Code, Cursor, OpenAI Codex, GitHub Copilot, Gemini CLI, and Antigravity. +# Installs skills, MCP server, and configuration for Claude Code, Cursor, OpenAI Codex, GitHub Copilot, Gemini CLI, Antigravity and OpenCode. # # Usage: irm https://raw.githubusercontent.com/databricks-solutions/ai-dev-kit/main/install.ps1 -OutFile install.ps1 # .\install.ps1 [OPTIONS] @@ -233,7 +233,7 @@ while ($i -lt $args.Count) { Write-Host " --mcp-only Skip skills installation" Write-Host " --mcp-path PATH Path to MCP server installation" Write-Host " --silent Silent mode (no output except errors)" - Write-Host " --tools LIST Comma-separated: claude,cursor,copilot,codex,gemini,antigravity" + Write-Host " --tools LIST Comma-separated: claude,cursor,copilot,codex,gemini,antigravity,opencode" Write-Host " --skills-profile LIST Comma-separated profiles: all,data-engineer,analyst,ai-ml-engineer,app-developer" Write-Host " --skills LIST Comma-separated skill names to install (overrides profile)" Write-Host " --list-skills List available skills and profiles, then exit" @@ -569,6 +569,7 @@ function Invoke-DetectTools { $hasGemini = $null -ne (Get-Command gemini -ErrorAction SilentlyContinue) $hasAntigravity = ($null -ne (Get-Command antigravity -ErrorAction SilentlyContinue)) -or (Test-Path "$env:LOCALAPPDATA\Programs\Antigravity\Antigravity.exe") + $hasOpencode = $null -ne (Get-Command opencode -ErrorAction SilentlyContinue) $claudeState = $hasClaude; $claudeHint = if ($hasClaude) { "detected" } else { "not found" } $cursorState = $hasCursor; $cursorHint = if ($hasCursor) { "detected" } else { "not found" } @@ -576,9 +577,10 @@ function Invoke-DetectTools { $copilotState = $hasCopilot; $copilotHint = if ($hasCopilot) { "detected" } else { "not found" } $geminiState = $hasGemini; $geminiHint = if ($hasGemini) { "detected" } else { "not found" } $antigravityState = $hasAntigravity; $antigravityHint = if ($hasAntigravity) { "detected" } else { "not found" } + $opencodeState = $hasOpencode; $opencodeHint = if ($hasOpencode) { "detected" } else { "not found" } # If nothing detected, default to claude - if (-not $hasClaude -and -not $hasCursor -and -not $hasCodex -and -not $hasCopilot -and -not $hasGemini -and -not $hasAntigravity) { + if (-not $hasClaude -and -not $hasCursor -and -not $hasCodex -and -not $hasCopilot -and -not $hasGemini -and -not $hasAntigravity -and -not $hasOpencode) { $claudeState = $true $claudeHint = "default" } @@ -595,6 +597,7 @@ function Invoke-DetectTools { @{ Label = "OpenAI Codex"; Value = "codex"; State = $codexState; Hint = $codexHint } @{ Label = "Gemini CLI"; Value = "gemini"; State = $geminiState; Hint = $geminiHint } @{ Label = "Antigravity"; Value = "antigravity"; State = $antigravityState; Hint = $antigravityHint } + @{ Label = "OpenCode"; Value = "opencode"; State = $opencodeState; Hint = $opencodeHint } ) $result = Select-Checkbox -Items $items @@ -1164,6 +1167,7 @@ function Install-Skills { $dirs += Join-Path $BaseDir ".agents\skills" } } + "opencode" { $dirs += Join-Path $BaseDir ".opencode\skills" } } } $dirs = $dirs | Select-Object -Unique @@ -1517,6 +1521,64 @@ Try asking: "List my SQL warehouses" or "Show my Unity Catalog schemas" Write-Ok "GEMINI.md" } +function Write-OpenCodeMcpJson { + param([string]$Path) + + $dir = Split-Path $Path -Parent + if (-not (Test-Path $dir)) { + New-Item -ItemType Directory -Path $dir -Force | Out-Null + } + + # Backup existing + if (Test-Path $Path) { + Copy-Item $Path "$Path.bak" -Force + Write-Msg "Backed up $(Split-Path $Path -Leaf) -> $(Split-Path $Path -Leaf).bak" + } + + # Try to merge with existing config + if ((Test-Path $Path) -and (Test-Path $script:VenvPython)) { + try { + $existing = Get-Content $Path -Raw | ConvertFrom-Json + } catch { + $existing = $null + } + } + + if ($existing) { + if (-not $existing.'$schema') { + $existing | Add-Member -NotePropertyName "$schema" -NotePropertyValue ([PSCustomObject]@{}) -Force + } + if (-not $existing.mcp) { + $existing | Add-Member -NotePropertyName "mcp" -NotePropertyValue ([PSCustomObject]@{}) -Force + } + $dbEntry = [PSCustomObject]@{ + type = "local" + command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') + environment = [PSCustomObject]@{ DATABRICKS_CONFIG_PROFILE = $script:Profile_ } + enabled = $true + } + $existing.mcp | Add-Member -NotePropertyName "databricks" -NotePropertyValue $dbEntry -Force + $existing = $existing | ConvertTo-Json -Depth 10 + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($Path, $existing, $Utf8NoBomEncoding) + } else { + Write-Msg " Debug: Else $existing" + $config = [PSCustomObject]@{ + '$schema' = 'https://opencode.ai/config.json' + mcp = @{ + databricks = @{ + type = 'local' + command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') + environment = [PSCustomObject]@{ DATABRICKS_CONFIG_PROFILE = $script:Profile_ } + enabled = $true + } + } + } | ConvertTo-Json -Depth 3 + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($Path, $config, $Utf8NoBomEncoding) + } +} + function Write-McpConfigs { param([string]$BaseDir) @@ -1588,6 +1650,16 @@ function Write-McpConfigs { } Write-GeminiMcpJson (Join-Path $env:USERPROFILE ".gemini\antigravity\mcp_config.json") Write-Ok "Antigravity MCP config" + } + "opencode" { + if ($script:Scope -eq "global") { + Write-OpenCodeMcpJson (Join-Path $env:USERPROFILE ".config\opencode\opencode.json") + } else { + Write-Msg " Debug: $BaseDir" + Write-OpenCodeMcpJson (Join-Path $BaseDir "opencode.json") + + } + Write-Ok "OpenCode CLI MCP config" } } } From fd4a60e8e1c6ae4bd0c6d6d0aa213c7ce14a3600 Mon Sep 17 00:00:00 2001 From: Pitusiray <45488098+Pitusiray@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:18:36 +0100 Subject: [PATCH 2/8] Disable Databricks MCP in install.ps1 --- install.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install.ps1 b/install.ps1 index aefc6e4c..93497ef7 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1555,14 +1555,13 @@ function Write-OpenCodeMcpJson { type = "local" command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') environment = [PSCustomObject]@{ DATABRICKS_CONFIG_PROFILE = $script:Profile_ } - enabled = $true + enabled = $false } $existing.mcp | Add-Member -NotePropertyName "databricks" -NotePropertyValue $dbEntry -Force $existing = $existing | ConvertTo-Json -Depth 10 $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False [System.IO.File]::WriteAllLines($Path, $existing, $Utf8NoBomEncoding) } else { - Write-Msg " Debug: Else $existing" $config = [PSCustomObject]@{ '$schema' = 'https://opencode.ai/config.json' mcp = @{ @@ -1570,7 +1569,7 @@ function Write-OpenCodeMcpJson { type = 'local' command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') environment = [PSCustomObject]@{ DATABRICKS_CONFIG_PROFILE = $script:Profile_ } - enabled = $true + enabled = $false } } } | ConvertTo-Json -Depth 3 @@ -1655,11 +1654,12 @@ function Write-McpConfigs { if ($script:Scope -eq "global") { Write-OpenCodeMcpJson (Join-Path $env:USERPROFILE ".config\opencode\opencode.json") } else { - Write-Msg " Debug: $BaseDir" Write-OpenCodeMcpJson (Join-Path $BaseDir "opencode.json") } Write-Ok "OpenCode CLI MCP config" + Write-Warn "OpenCode: MCP servers are disabled by default." + Write-Msg " Enable in: opencode -> /mcps -> Toggle 'databricks' by pressing spacebar" } } } From cd535d982675f699edf85d89d4c8b1d7814b083c Mon Sep 17 00:00:00 2001 From: Pitusiray <45488098+Pitusiray@users.noreply.github.com> Date: Fri, 10 Apr 2026 09:38:29 +0200 Subject: [PATCH 3/8] Fix formatting and spacing in install.ps1 --- install.ps1 | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/install.ps1 b/install.ps1 index 93497ef7..ed6b205d 100644 --- a/install.ps1 +++ b/install.ps1 @@ -569,7 +569,7 @@ function Invoke-DetectTools { $hasGemini = $null -ne (Get-Command gemini -ErrorAction SilentlyContinue) $hasAntigravity = ($null -ne (Get-Command antigravity -ErrorAction SilentlyContinue)) -or (Test-Path "$env:LOCALAPPDATA\Programs\Antigravity\Antigravity.exe") - $hasOpencode = $null -ne (Get-Command opencode -ErrorAction SilentlyContinue) + $hasOpencode = $null -ne (Get-Command opencode -ErrorAction SilentlyContinue) $claudeState = $hasClaude; $claudeHint = if ($hasClaude) { "detected" } else { "not found" } $cursorState = $hasCursor; $cursorHint = if ($hasCursor) { "detected" } else { "not found" } @@ -577,7 +577,7 @@ function Invoke-DetectTools { $copilotState = $hasCopilot; $copilotHint = if ($hasCopilot) { "detected" } else { "not found" } $geminiState = $hasGemini; $geminiHint = if ($hasGemini) { "detected" } else { "not found" } $antigravityState = $hasAntigravity; $antigravityHint = if ($hasAntigravity) { "detected" } else { "not found" } - $opencodeState = $hasOpencode; $opencodeHint = if ($hasOpencode) { "detected" } else { "not found" } + $opencodeState = $hasOpencode; $opencodeHint = if ($hasOpencode) { "detected" } else { "not found" } # If nothing detected, default to claude if (-not $hasClaude -and -not $hasCursor -and -not $hasCodex -and -not $hasCopilot -and -not $hasGemini -and -not $hasAntigravity -and -not $hasOpencode) { @@ -597,7 +597,7 @@ function Invoke-DetectTools { @{ Label = "OpenAI Codex"; Value = "codex"; State = $codexState; Hint = $codexHint } @{ Label = "Gemini CLI"; Value = "gemini"; State = $geminiState; Hint = $geminiHint } @{ Label = "Antigravity"; Value = "antigravity"; State = $antigravityState; Hint = $antigravityHint } - @{ Label = "OpenCode"; Value = "opencode"; State = $opencodeState; Hint = $opencodeHint } + @{ Label = "OpenCode"; Value = "opencode"; State = $opencodeState; Hint = $opencodeHint } ) $result = Select-Checkbox -Items $items @@ -1167,7 +1167,7 @@ function Install-Skills { $dirs += Join-Path $BaseDir ".agents\skills" } } - "opencode" { $dirs += Join-Path $BaseDir ".opencode\skills" } + "opencode" { $dirs += Join-Path $BaseDir ".opencode\skills" } } } $dirs = $dirs | Select-Object -Unique @@ -1545,7 +1545,7 @@ function Write-OpenCodeMcpJson { } if ($existing) { - if (-not $existing.'$schema') { + if (-not $existing.'$schema') { $existing | Add-Member -NotePropertyName "$schema" -NotePropertyValue ([PSCustomObject]@{}) -Force } if (-not $existing.mcp) { @@ -1553,28 +1553,28 @@ function Write-OpenCodeMcpJson { } $dbEntry = [PSCustomObject]@{ type = "local" - command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') + command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') environment = [PSCustomObject]@{ DATABRICKS_CONFIG_PROFILE = $script:Profile_ } - enabled = $false + enabled = $false } $existing.mcp | Add-Member -NotePropertyName "databricks" -NotePropertyValue $dbEntry -Force $existing = $existing | ConvertTo-Json -Depth 10 - $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False - [System.IO.File]::WriteAllLines($Path, $existing, $Utf8NoBomEncoding) + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($Path, $existing, $Utf8NoBomEncoding) } else { - $config = [PSCustomObject]@{ - '$schema' = 'https://opencode.ai/config.json' - mcp = @{ - databricks = @{ - type = 'local' - command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') - environment = [PSCustomObject]@{ DATABRICKS_CONFIG_PROFILE = $script:Profile_ } - enabled = $false - } - } - } | ConvertTo-Json -Depth 3 - $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False - [System.IO.File]::WriteAllLines($Path, $config, $Utf8NoBomEncoding) + $config = [PSCustomObject]@{ + '$schema' = 'https://opencode.ai/config.json' + mcp = @{ + databricks = @{ + type = 'local' + command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') + environment = [PSCustomObject]@{ DATABRICKS_CONFIG_PROFILE = $script:Profile_ } + enabled = $false + } + } + } | ConvertTo-Json -Depth 3 + $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False + [System.IO.File]::WriteAllLines($Path, $config, $Utf8NoBomEncoding) } } @@ -1650,15 +1650,15 @@ function Write-McpConfigs { Write-GeminiMcpJson (Join-Path $env:USERPROFILE ".gemini\antigravity\mcp_config.json") Write-Ok "Antigravity MCP config" } - "opencode" { + "opencode" { if ($script:Scope -eq "global") { Write-OpenCodeMcpJson (Join-Path $env:USERPROFILE ".config\opencode\opencode.json") } else { Write-OpenCodeMcpJson (Join-Path $BaseDir "opencode.json") - + } Write-Ok "OpenCode CLI MCP config" - Write-Warn "OpenCode: MCP servers are disabled by default." + Write-Warn "OpenCode: MCP servers are disabled by default." Write-Msg " Enable in: opencode -> /mcps -> Toggle 'databricks' by pressing spacebar" } } From e717a642ddf907a7a016e373145406566f1b232c Mon Sep 17 00:00:00 2001 From: Pitusiray <45488098+Pitusiray@users.noreply.github.com> Date: Fri, 10 Apr 2026 09:43:38 +0200 Subject: [PATCH 4/8] Enable Databricks MCP in install.ps1 --- install.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/install.ps1 b/install.ps1 index ed6b205d..19413fd5 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1555,7 +1555,7 @@ function Write-OpenCodeMcpJson { type = "local" command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') environment = [PSCustomObject]@{ DATABRICKS_CONFIG_PROFILE = $script:Profile_ } - enabled = $false + enabled = $true } $existing.mcp | Add-Member -NotePropertyName "databricks" -NotePropertyValue $dbEntry -Force $existing = $existing | ConvertTo-Json -Depth 10 @@ -1569,7 +1569,7 @@ function Write-OpenCodeMcpJson { type = 'local' command = @($script:VenvPython -replace '\\', '/') + @($script:McpEntry -replace '\\', '/') environment = [PSCustomObject]@{ DATABRICKS_CONFIG_PROFILE = $script:Profile_ } - enabled = $false + enabled = $true } } } | ConvertTo-Json -Depth 3 @@ -1658,8 +1658,6 @@ function Write-McpConfigs { } Write-Ok "OpenCode CLI MCP config" - Write-Warn "OpenCode: MCP servers are disabled by default." - Write-Msg " Enable in: opencode -> /mcps -> Toggle 'databricks' by pressing spacebar" } } } From ce9c7901d67d7df6de1a4c44e195c6da53597c31 Mon Sep 17 00:00:00 2001 From: Pitusiray <45488098+Pitusiray@users.noreply.github.com> Date: Fri, 10 Apr 2026 09:46:05 +0200 Subject: [PATCH 5/8] Add summary message for opening project in Opencode --- install.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/install.ps1 b/install.ps1 index 19413fd5..1b049907 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1713,6 +1713,10 @@ function Show-Summary { if ($script:Tools -match 'antigravity') { Write-Msg "$step. Open your project in Antigravity to use Databricks skills and MCP tools" $step++ + } + if ($script:Tools -match 'opencode') { + Write-Msg "$step. Open your project in Opencode to use Databricks skills and MCP tools" + $step++ } Write-Msg "$step. Open your project in your tool of choice" $step++ From 9233fd9aec62a182424b0ddab3c8a26bbd9f1cea Mon Sep 17 00:00:00 2001 From: Pitusiray <45488098+Pitusiray@users.noreply.github.com> Date: Fri, 10 Apr 2026 10:37:29 +0200 Subject: [PATCH 6/8] Added opencode global skills install in install.ps1 --- install.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/install.ps1 b/install.ps1 index 1b049907..f4d0f0ea 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1167,7 +1167,13 @@ function Install-Skills { $dirs += Join-Path $BaseDir ".agents\skills" } } - "opencode" { $dirs += Join-Path $BaseDir ".opencode\skills" } + "opencode" { + if ($script:Scope -eq "global") { + $dirs += Join-Path $env:USERPROFILE ".config\opencode\skills" + } else { + $dirs += Join-Path $BaseDir ".opencode\skills" + } + } } } $dirs = $dirs | Select-Object -Unique From 728bd9b3a726acee8c182df568989869f7b17e3f Mon Sep 17 00:00:00 2001 From: Pitusiray <45488098+Pitusiray@users.noreply.github.com> Date: Fri, 10 Apr 2026 13:23:22 +0200 Subject: [PATCH 7/8] Remove check '$schema' property for opencode mcp objects Remove check '$schema' property for opencode mcp objects in install.ps1. It should always be already created --- install.ps1 | 3 --- 1 file changed, 3 deletions(-) diff --git a/install.ps1 b/install.ps1 index f4d0f0ea..530be3f2 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1551,9 +1551,6 @@ function Write-OpenCodeMcpJson { } if ($existing) { - if (-not $existing.'$schema') { - $existing | Add-Member -NotePropertyName "$schema" -NotePropertyValue ([PSCustomObject]@{}) -Force - } if (-not $existing.mcp) { $existing | Add-Member -NotePropertyName "mcp" -NotePropertyValue ([PSCustomObject]@{}) -Force } From 7d16d40e0fb2e9d3cce1863762bc900d3392d195 Mon Sep 17 00:00:00 2001 From: Pitusiray <45488098+Pitusiray@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:48:41 +0200 Subject: [PATCH 8/8] Add support for Opencode in install.sh --- install.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 114cb2c4..b5798939 100644 --- a/install.sh +++ b/install.sh @@ -503,6 +503,7 @@ detect_tools() { local has_copilot=false local has_gemini=false local has_antigravity=false + local has_opencode=false command -v claude >/dev/null 2>&1 && has_claude=true { [ -d "/Applications/Cursor.app" ] || command -v cursor >/dev/null 2>&1; } && has_cursor=true @@ -510,19 +511,21 @@ detect_tools() { { [ -d "/Applications/Visual Studio Code.app" ] || command -v code >/dev/null 2>&1; } && has_copilot=true { command -v gemini >/dev/null 2>&1 || [ -f "$HOME/.gemini/local/gemini" ]; } && has_gemini=true { [ -d "/Applications/Antigravity.app" ] || command -v antigravity >/dev/null 2>&1; } && has_antigravity=true + command -v opencode >/dev/null 2>&1 && has_opencode=true # Build checkbox items: "Label|value|on_or_off|hint" - local claude_state="off" cursor_state="off" codex_state="off" copilot_state="off" gemini_state="off" antigravity_state="off" - local claude_hint="not found" cursor_hint="not found" codex_hint="not found" copilot_hint="not found" gemini_hint="not found" antigravity_hint="not found" + local claude_state="off" cursor_state="off" codex_state="off" copilot_state="off" gemini_state="off" antigravity_state="off" opencode_state="off" + local claude_hint="not found" cursor_hint="not found" codex_hint="not found" copilot_hint="not found" gemini_hint="not found" antigravity_hint="not found" opencode_hint="not found" [ "$has_claude" = true ] && claude_state="on" && claude_hint="detected" [ "$has_cursor" = true ] && cursor_state="on" && cursor_hint="detected" [ "$has_codex" = true ] && codex_state="on" && codex_hint="detected" [ "$has_copilot" = true ] && copilot_state="on" && copilot_hint="detected" [ "$has_gemini" = true ] && gemini_state="on" && gemini_hint="detected" [ "$has_antigravity" = true ] && antigravity_state="on" && antigravity_hint="detected" + [ "$has_opencode" = true ] && opencode_state="on" && opencode_hint="detected" # If nothing detected, pre-select claude as default - if [ "$has_claude" = false ] && [ "$has_cursor" = false ] && [ "$has_codex" = false ] && [ "$has_copilot" = false ] && [ "$has_gemini" = false ] && [ "$has_antigravity" = false ]; then + if [ "$has_claude" = false ] && [ "$has_cursor" = false ] && [ "$has_codex" = false ] && [ "$has_copilot" = false ] && [ "$has_gemini" = false ] && [ "$has_antigravity" = false ] && [ "$has_opencode" = false ]; then claude_state="on" claude_hint="default" fi @@ -539,6 +542,7 @@ detect_tools() { "OpenAI Codex|codex|${codex_state}|${codex_hint}" \ "Gemini CLI|gemini|${gemini_state}|${gemini_hint}" \ "Antigravity|antigravity|${antigravity_state}|${antigravity_hint}" \ + "Opencode|opencode|${opencode_state}|${opencode_hint}" \ ) else # Silent: use detected defaults @@ -549,6 +553,7 @@ detect_tools() { [ "$has_codex" = true ] && tools="${tools:+$tools }codex" [ "$has_gemini" = true ] && tools="${tools:+$tools }gemini" [ "$has_antigravity" = true ] && tools="${tools:+$tools }antigravity" + [ "$has_opencode" = true ] && tools="${tools:+$tools }opencode" [ -z "$tools" ] && tools="claude" TOOLS="$tools" fi @@ -1095,6 +1100,13 @@ install_skills() { else dirs+=("$base_dir/.agents/skills") fi + ;; + opencode) + if [ "$SCOPE" = "global" ]; then + dirs+=("$HOME/.config/opencode/skills") + else + dirs+=("$base_dir/.opencode/skills") + fi ;; esac done @@ -1280,6 +1292,42 @@ with open('$path', 'w') as f: json.dump(cfg, f, indent=2); f.write('\n') EOF } +write_opencode_mcp_json() { + local path=$1 + mkdir -p "$(dirname "$path")" + + # Backup existing file before any modifications + if [ -f "$path" ]; then + cp "$path" "${path}.bak" + msg "${D}Backed up ${path##*/} → ${path##*/}.bak${N}" + fi + + if [ -f "$path" ] && [ -f "$VENV_PYTHON" ]; then + "$VENV_PYTHON" -c " +import json, sys +try: + with open('$path') as f: cfg = json.load(f) +except: cfg = {'\$schema' : 'https://opencode.ai/config.json'} +cfg.setdefault('mcp', {})['databricks'] = {'type':'local', 'command': ['$VENV_PYTHON','$MCP_ENTRY'], 'enabled': True, 'environment': {'DATABRICKS_CONFIG_PROFILE': '$PROFILE'}} +with open('$path', 'w') as f: json.dump(cfg, f, indent=2); f.write('\n') +" 2>/dev/null && return + fi + + cat > "$path" << EOF +{ + "\$schema" : "https://opencode.ai/config.json", + "mcp": { + "databricks": { + "type": "local", + "command": ["$VENV_PYTHON","$MCP_ENTRY"], + "enabled": true, + "environment": {"DATABRICKS_CONFIG_PROFILE": "$PROFILE"} + } + } +} +EOF +} + write_mcp_toml() { local path=$1 mkdir -p "$(dirname "$path")" @@ -1485,6 +1533,14 @@ write_mcp_configs() { fi write_gemini_mcp_json "$HOME/.gemini/antigravity/mcp_config.json" ok "Antigravity MCP config" + ;; + opencode) + if [ "$SCOPE" = "global" ]; then + write_opencode_mcp_json "$HOME/.config/opencode/opencode.json" + else + write_opencode_mcp_json "$base_dir/opencode.json" + fi + ok "Opencode CLI MCP config" ;; esac done @@ -1532,6 +1588,10 @@ summary() { if echo "$TOOLS" | grep -q antigravity; then msg "${step}. Open your project in Antigravity to use Databricks skills and MCP tools" step=$((step + 1)) + fi + if echo "$TOOLS" | grep -q onpencode; then + msg "${step}. Open your project in Opencode to use Databricks skills and MCP tools" + step=$((step + 1)) fi msg "${step}. Open your project in your tool of choice" step=$((step + 1))