Skip to content

Commit aafc932

Browse files
committed
prototype module
1 parent 8985231 commit aafc932

File tree

2 files changed

+50
-4
lines changed

2 files changed

+50
-4
lines changed

registry/coder/modules/aider/main.tf

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,18 @@ variable "custom_env_var_name" {
128128
default = ""
129129
}
130130

131-
variable "install_agentapi" {
131+
variable "use_tasks" {
132132
type = bool
133-
description = "Whether to install AgentAPI."
133+
description = "the Use Task variable will provide agentapi + Task support"
134134
default = true
135135
}
136136

137+
# variable "install_agentapi" {
138+
# type = bool
139+
# description = "Whether to install AgentAPI."
140+
# default = true
141+
# }
142+
137143
variable "agentapi_version" {
138144
type = string
139145
description = "The version of AgentAPI to install."
@@ -257,7 +263,7 @@ module "agentapi" {
257263
cli_app_slug = "${local.app_slug}-cli"
258264
cli_app_display_name = "Aider CLI"
259265
module_dir_name = local.module_dir_name
260-
install_agentapi = var.install_agentapi
266+
install_agentapi = var.use_tasks ? true : false
261267
agentapi_version = var.agentapi_version
262268
pre_install_script = var.experiment_pre_install_script
263269
post_install_script = var.experiment_post_install_script
@@ -293,3 +299,44 @@ module "agentapi" {
293299
EOT
294300
}
295301

302+
resource "coder_script" "aider" {
303+
agent_id = var.agent_id
304+
display_name = "Aider"
305+
icon = var.icon
306+
script = <<-EOT
307+
#!/bin/bash
308+
set -e
309+
function install_aider() {
310+
echo "pipx installing..."
311+
sudo apt-get install -y pipx
312+
echo "pipx installed!"
313+
pipx ensurepath
314+
mkdir -p "${var.folder}/.local/bin"
315+
export PATH="$HOME/.local/bin:${var.folder}/.local/bin:$PATH" # ensure in current shell too
316+
317+
if ! command_exists aider; then
318+
echo "Installing Aider via pipx..."
319+
pipx install --force aider-install
320+
aider-install
321+
fi
322+
echo "Aider installed: $(aider --version || echo 'check failed the Aider module insatllation failed')"
323+
}
324+
EOT
325+
run_on_start = true
326+
}
327+
328+
resource "coder_app" "aider_cli" {
329+
agent_id = var.agent_id
330+
slug = "aider"
331+
display_name = "Aider"
332+
icon = var.icon
333+
command = <<-EOT
334+
#!/bin/bash
335+
set -e
336+
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
337+
cd "${var.folder}"
338+
echo "Starting Aider directly..."
339+
export ${local.env_var_name}="${var.credentials}"
340+
aider ${local.model_flag} ${var.model}
341+
EOT
342+
}

registry/coder/modules/aider/scripts/install.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ function install_aider() {
1616
sudo apt-get install -y pipx
1717
echo "pipx installed!"
1818
pipx ensurepath
19-
echo $PATH
2019
mkdir -p "$AIDER_START_DIRECTORY/.local/bin"
2120
export PATH="$HOME/.local/bin:$AIDER_START_DIRECTORY/.local/bin:$PATH" # ensure in current shell too
2221

0 commit comments

Comments
 (0)