File tree Expand file tree Collapse file tree 4 files changed +19
-15
lines changed
registry/coder-labs/modules/gemini Expand file tree Collapse file tree 4 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -204,7 +204,9 @@ describe("gemini", async () => {
204204 task_prompt : taskPrompt ,
205205 } ,
206206 } ) ;
207- await execModuleScript ( id ) ;
207+ await execModuleScript ( id , {
208+ GEMINI_TASK_PROMPT : taskPrompt ,
209+ } ) ;
208210 const resp = await readFileContainer ( id , "/home/coder/.gemini-module/agentapi-start.log" ) ;
209211 expect ( resp ) . toContain ( "Running automated task:" ) ;
210212 } ) ;
Original file line number Diff line number Diff line change @@ -185,12 +185,8 @@ module "agentapi" {
185185 web_app_group = var. group
186186 web_app_icon = var. icon
187187 web_app_display_name = " Gemini"
188- cli_app = true
189188 cli_app_slug = " ${ local . app_slug } -cli"
190189 cli_app_display_name = " Gemini CLI"
191- cli_app_icon = var. icon
192- cli_app_order = var. order
193- cli_app_group = var. group
194190 module_dir_name = local. module_dir_name
195191 install_agentapi = var. install_agentapi
196192 agentapi_version = var. agentapi_version
@@ -225,7 +221,7 @@ module "agentapi" {
225221 GEMINI_YOLO_MODE='${ var . enable_yolo_mode } ' \
226222 GEMINI_MODEL='${ var . gemini_model } ' \
227223 GEMINI_START_DIRECTORY='${ var . folder } ' \
228- GEMINI_TASK_PROMPT='${ base64encode ( var. task_prompt ) } ' \
224+ GEMINI_TASK_PROMPT='${ var . task_prompt } ' \
229225 /tmp/start.sh
230226 EOT
231227}
Original file line number Diff line number Diff line change @@ -150,9 +150,15 @@ function add_system_prompt_if_exists() {
150150 fi
151151}
152152
153+ function configure_mcp() {
154+ export CODER_MCP_APP_STATUS_SLUG=" gemini"
155+ export CODER_MCP_AI_AGENTAPI_URL=" http://localhost:3284"
156+ coder exp mcp configure gemini " ${GEMINI_START_DIRECTORY} "
157+ }
153158
154159install_gemini
155160gemini --version
156161populate_settings_json
157162add_system_prompt_if_exists
163+ configure_mcp
158164
Original file line number Diff line number Diff line change 22set -o errexit
33set -o pipefail
44
5- # Handle parameters from agentapi module
6- USE_PROMPT=" $1 "
5+
76AGENTAPI_PORT=" $2 "
87
98source " $HOME " /.bashrc
2019
2120printf " Version: %s\n" " $( gemini --version) "
2221
23- GEMINI_TASK_PROMPT=$( echo -n " $GEMINI_TASK_PROMPT " | base64 -d)
22+ MODULE_DIR=" $HOME /.gemini-module"
23+ mkdir -p " $MODULE_DIR "
2424
2525if command_exists gemini; then
2626 printf " Gemini is installed\n"
4747 }
4848fi
4949
50- # Handle prompt logic based on parameters
51- if [ -n " $USE_PROMPT " ] && [ " $USE_PROMPT " = " true" ] && [ -n " $GEMINI_TASK_PROMPT " ]; then
50+ if [ -n " $GEMINI_TASK_PROMPT " ]; then
5251 printf " Running automated task: %s\n" " $GEMINI_TASK_PROMPT "
5352 PROMPT=" Every step of the way, report tasks to Coder with proper descriptions and statuses. Your task at hand: $GEMINI_TASK_PROMPT "
54- GEMINI_ARGS=(--prompt)
55- GEMINI_ARGS+=(" $PROMPT " )
53+ PROMPT_FILE=" $MODULE_DIR /prompt.txt"
54+ echo -n " $PROMPT " > " $PROMPT_FILE "
55+ GEMINI_ARGS=(--prompt " $PROMPT " )
5656else
5757 printf " Starting Gemini CLI in interactive mode.\n"
5858 GEMINI_ARGS=()
7373 printf " No API key provided (neither GEMINI_API_KEY nor GOOGLE_API_KEY)\n"
7474fi
7575
76- # Use the port parameter if provided, otherwise default to 3284
7776PORT=${AGENTAPI_PORT:- 3284}
78- agentapi server --port " $PORT " --term-width 67 --term-height 1190 -- gemini " ${GEMINI_ARGS[@]} "
77+ agentapi server --port " $PORT " --term-width 67 --term-height 1190 -- \
78+ bash -c " $( printf ' %q ' gemini " ${GEMINI_ARGS[@]} " ) "
You can’t perform that action at this time.
0 commit comments