Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions registry/coder-labs/modules/gemini/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Run [Gemini CLI](https://github.com/google-gemini/gemini-cli) in your workspace
```tf
module "gemini" {
source = "registry.coder.com/coder-labs/gemini/coder"
version = "3.0.0"
version = "3.0.1"
agent_id = coder_agent.main.id
folder = "/home/coder/project"
}
Expand Down Expand Up @@ -46,7 +46,7 @@ variable "gemini_api_key" {

module "gemini" {
source = "registry.coder.com/coder-labs/gemini/coder"
version = "3.0.0"
version = "3.0.1"
agent_id = coder_agent.main.id
gemini_api_key = var.gemini_api_key
folder = "/home/coder/project"
Expand Down Expand Up @@ -94,7 +94,7 @@ data "coder_parameter" "ai_prompt" {
module "gemini" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder-labs/gemini/coder"
version = "3.0.0"
version = "3.0.1"
agent_id = coder_agent.main.id
gemini_api_key = var.gemini_api_key
gemini_model = "gemini-2.5-flash"
Expand All @@ -105,6 +105,22 @@ module "gemini" {
You are a helpful coding assistant. Always explain your code changes clearly.
YOU MUST REPORT ALL TASKS TO CODER.
EOT
pre_install_script = <<-EOT
#!/bin/bash
set -e

echo "Installing Node.js via NodeSource..."

sudo apt-get update -qq && sudo apt-get install -y curl ca-certificates

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash -

sudo apt-get install -y nodejs

echo "Node version: $(node -v)"
echo "npm version: $(npm -v)"
echo "Node install complete."
EOT
}
```

Expand All @@ -118,7 +134,7 @@ For enterprise users who prefer Google's Vertex AI platform:
```tf
module "gemini" {
source = "registry.coder.com/coder-labs/gemini/coder"
version = "3.0.0"
version = "3.0.1"
agent_id = coder_agent.main.id
gemini_api_key = var.gemini_api_key
folder = "/home/coder/project"
Expand Down
10 changes: 2 additions & 8 deletions registry/coder-labs/modules/gemini/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,16 @@ locals {
base_extensions = <<-EOT
{
"coder": {
"command": "coder",
"args": [
"exp",
"mcp",
"server"
],
"command": "coder",
"description": "Report ALL tasks and statuses (in progress, done, failed) you are working on.",
"enabled": true,
"env": {
"CODER_MCP_APP_STATUS_SLUG": "${local.app_slug}",
"CODER_MCP_AI_AGENTAPI_URL": "http://localhost:3284"
},
"name": "Coder",
"timeout": 3000,
"type": "stdio",
"trust": true
}
}
}
EOT
Expand Down
21 changes: 21 additions & 0 deletions registry/coder-labs/modules/gemini/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ echo "--------------------------------"
printf "gemini_config: %s\n" "$ARG_GEMINI_CONFIG"
printf "install: %s\n" "$ARG_INSTALL"
printf "gemini_version: %s\n" "$ARG_GEMINI_VERSION"
printf "BASE_EXTENSIONS: %s\n" "$BASE_EXTENSIONS"
echo "--------------------------------"

set +o nounset
Expand Down Expand Up @@ -140,6 +141,25 @@ function add_system_prompt_if_exists() {
fi
}

function patch_coder_mcp_command() {
CODER_BIN=$(which coder)
SETTINGS_PATH="$HOME/.gemini/settings.json"

if [ -z "$CODER_BIN" ]; then
printf "Warning: could not find coder binary, MCP command path not patched.\n"
return
fi

printf "Patching coder MCP command path to: %s\n" "$CODER_BIN"

TMP_SETTINGS=$(mktemp)
jq --arg bin "$CODER_BIN" \
'.mcpServers.coder.command = $bin' \
"$SETTINGS_PATH" > "$TMP_SETTINGS" && mv "$TMP_SETTINGS" "$SETTINGS_PATH"

printf "Patch complete.\n"
}

function configure_mcp() {
export CODER_MCP_APP_STATUS_SLUG="gemini"
export CODER_MCP_AI_AGENTAPI_URL="http://localhost:3284"
Expand All @@ -149,4 +169,5 @@ function configure_mcp() {
install_gemini
populate_settings_json
add_system_prompt_if_exists
patch_coder_mcp_command
configure_mcp
Loading