-
Notifications
You must be signed in to change notification settings - Fork 146
refactor(registry/coder-labs/modules/gemini): remove agentapi, tasks, start script #890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,21 +8,23 @@ tags: [agent, gemini, ai, google, tasks] | |
|
|
||
| # Gemini CLI | ||
|
|
||
| Run [Gemini CLI](https://github.com/google-gemini/gemini-cli) in your workspace to access Google's Gemini AI models for interactive coding assistance and automated task execution. | ||
| Install and configure the [Gemini CLI](https://github.com/google-gemini/gemini-cli) in your workspace to access Google's Gemini AI models for interactive coding assistance. | ||
|
|
||
| ```tf | ||
| module "gemini" { | ||
| source = "registry.coder.com/coder-labs/gemini/coder" | ||
| version = "3.0.1" | ||
| version = "4.0.0" | ||
| agent_id = coder_agent.main.id | ||
| folder = "/home/coder/project" | ||
| } | ||
| ``` | ||
|
|
||
| > [!WARNING] | ||
| > If upgrading from v3.x.x of this module: v4 is a major refactor that drops support for [Coder Tasks](https://coder.com/docs/ai-coder/tasks). Keep using v3.x.x if you depend on them. See the [PR description](https://github.com/coder/registry/pull/879) for a full migration guide. | ||
|
|
||
| ## Features | ||
|
|
||
| - **Interactive AI Assistance**: Run Gemini CLI directly in your terminal for coding help | ||
| - **Automated Task Execution**: Execute coding tasks automatically via AgentAPI integration | ||
| - **Multiple AI Models**: Support for Gemini 2.5 Pro, Flash, and other Google AI models | ||
| - **API Key Integration**: Seamless authentication with Gemini API | ||
| - **MCP Server Integration**: Built-in Coder MCP server for task reporting | ||
|
|
@@ -37,39 +39,16 @@ module "gemini" { | |
|
|
||
| ### Basic setup | ||
|
|
||
| ```tf | ||
| variable "gemini_api_key" { | ||
| type = string | ||
| description = "Gemini API key" | ||
| sensitive = true | ||
| } | ||
|
|
||
| module "gemini" { | ||
| source = "registry.coder.com/coder-labs/gemini/coder" | ||
| version = "3.0.1" | ||
| agent_id = coder_agent.main.id | ||
| gemini_api_key = var.gemini_api_key | ||
| folder = "/home/coder/project" | ||
| } | ||
| ``` | ||
|
|
||
| This basic setup will: | ||
|
|
||
| - Install Gemini CLI in the workspace | ||
| - Configure authentication with your API key | ||
| - Set Gemini to run in `/home/coder/project` directory | ||
| - Enable interactive use from the terminal | ||
| - Set up MCP server integration for task reporting | ||
|
|
||
| ### Automated task execution (Experimental) | ||
|
|
||
| > This functionality is in early access and is still evolving. | ||
| > For now, we recommend testing it in a demo or staging environment, | ||
| > rather than deploying to production | ||
| > | ||
| > Learn more in [the Coder documentation](https://coder.com/docs/ai-coder) | ||
|
|
||
| ```tf | ||
| locals { | ||
| gemini_workdir = "/home/coder/project" | ||
| } | ||
|
|
||
| variable "gemini_api_key" { | ||
| type = string | ||
| description = "Gemini API key" | ||
|
|
@@ -83,29 +62,15 @@ module "coder-login" { | |
| agent_id = coder_agent.main.id | ||
| } | ||
|
|
||
| data "coder_parameter" "ai_prompt" { | ||
| type = "string" | ||
| name = "AI Prompt" | ||
| default = "" | ||
| description = "Task prompt for automated Gemini execution" | ||
| mutable = true | ||
| } | ||
|
|
||
| module "gemini" { | ||
| count = data.coder_workspace.me.start_count | ||
| source = "registry.coder.com/coder-labs/gemini/coder" | ||
| version = "3.0.1" | ||
| agent_id = coder_agent.main.id | ||
| gemini_api_key = var.gemini_api_key | ||
| gemini_model = "gemini-2.5-flash" | ||
| folder = "/home/coder/project" | ||
| task_prompt = data.coder_parameter.ai_prompt.value | ||
| enable_yolo_mode = true # Auto-approve all tool calls for automation | ||
| gemini_system_prompt = <<-EOT | ||
| You are a helpful coding assistant. Always explain your code changes clearly. | ||
| YOU MUST REPORT ALL TASKS TO CODER. | ||
| EOT | ||
| pre_install_script = <<-EOT | ||
| count = data.coder_workspace.me.start_count | ||
| source = "registry.coder.com/coder-labs/gemini/coder" | ||
| version = "4.0.0" | ||
| agent_id = coder_agent.main.id | ||
| gemini_api_key = var.gemini_api_key | ||
| gemini_model = "gemini-2.5-flash" | ||
| workdir = locals.workdir | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1 [DEREM-2] Two errors compound here:
Correct reference:
|
||
| pre_install_script = <<-EOT | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
|
|
@@ -122,10 +87,21 @@ module "gemini" { | |
| echo "Node install complete." | ||
| EOT | ||
| } | ||
| ``` | ||
|
|
||
| > [!WARNING] | ||
| > YOLO mode automatically approves all tool calls without user confirmation. The agent has access to your machine's file system and terminal. Only enable in trusted, isolated environments. | ||
| resource "coder_app" "gemini" { | ||
| agent_id = coder_agent.main.id | ||
| slug = "gemini" | ||
| display_name = "Gemini" | ||
| icon = "/icon/openai.svg" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2 [DEREM-3]
|
||
| open_in = "slim-window" | ||
| command = <<-EOT | ||
| #!/bin/bash | ||
| set -e | ||
| cd "${local.gemini_workdir}" | ||
| gemini | ||
| EOT | ||
| } | ||
| ``` | ||
|
|
||
| ### Using Vertex AI (Enterprise) | ||
|
|
||
|
|
@@ -134,24 +110,25 @@ For enterprise users who prefer Google's Vertex AI platform: | |
| ```tf | ||
| module "gemini" { | ||
| source = "registry.coder.com/coder-labs/gemini/coder" | ||
| version = "3.0.1" | ||
| version = "4.0.0" | ||
| agent_id = coder_agent.main.id | ||
| gemini_api_key = var.gemini_api_key | ||
| folder = "/home/coder/project" | ||
| workdir = "/home/coder/project" | ||
| use_vertexai = true | ||
| } | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| - If Gemini CLI is not found, ensure your API key is valid (`install_gemini` defaults to `true`) | ||
| - Check logs in `~/.gemini-module/` for install/start output | ||
| - Use the `gemini_api_key` variable to avoid requiring Google sign-in | ||
|
DevelopmentCats marked this conversation as resolved.
|
||
| Check the log files in `~/.coder-modules/coder-labs/gemini/logs/` for detailed information. | ||
|
|
||
| The module creates log files in the workspace's `~/.gemini-module` directory for debugging purposes. | ||
| ```bash | ||
| cat ~/.coder-modules/coder-labs/gemini/logs/install.log | ||
| cat ~/.coder-modules/coder-labs/gemini/logs/pre_install.log | ||
| cat ~/.coder-modules/coder-labs/gemini/logs/post_install.log | ||
| ``` | ||
|
|
||
| ## References | ||
|
|
||
| - [Gemini CLI Documentation](https://github.com/google-gemini/gemini-cli/blob/main/docs/index.md) | ||
| - [AgentAPI Documentation](https://github.com/coder/agentapi) | ||
| - [Coder AI Agents Guide](https://coder.com/docs/ai-coder) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1 [DEREM-1] Quick-start example uses
folderbut the variable was renamed toworkdirin this PR. Any user copying this snippet gets:Fix:
folder→workdir. (Netero)