Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
71 changes: 39 additions & 32 deletions registry/coder/modules/aider/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ variable "order" {
default = null
}

variable "group" {
type = string
description = "The name of a group that this app belongs to."
default = null
}

variable "icon" {
type = string
description = "The icon to use for the app."
Expand Down Expand Up @@ -224,17 +230,17 @@ resource "coder_script" "aider" {
}

echo "Setting up Aider AI pair programming..."

if [ "${var.use_screen}" = "true" ] && [ "${var.use_tmux}" = "true" ]; then
echo "Error: Both use_screen and use_tmux cannot be enabled at the same time."
exit 1
fi

mkdir -p "${var.folder}"

if [ "$(uname)" = "Linux" ]; then
echo "Checking dependencies for Linux..."

if [ "${var.use_tmux}" = "true" ]; then
if ! command_exists tmux; then
echo "Installing tmux for persistent sessions..."
Expand Down Expand Up @@ -296,7 +302,7 @@ resource "coder_script" "aider" {

if [ "${var.install_aider}" = "true" ]; then
echo "Installing Aider..."

if ! command_exists python3 || ! command_exists pip3; then
echo "Installing Python dependencies required for Aider..."
if command -v apt-get >/dev/null 2>&1; then
Expand All @@ -319,67 +325,67 @@ resource "coder_script" "aider" {
else
echo "Python is already installed, skipping installation."
fi

if ! command_exists aider; then
curl -LsSf https://aider.chat/install.sh | sh
fi

if [ -f "$HOME/.bashrc" ]; then
if ! grep -q 'export PATH="$HOME/bin:$PATH"' "$HOME/.bashrc"; then
echo 'export PATH="$HOME/bin:$PATH"' >> "$HOME/.bashrc"
fi
fi

if [ -f "$HOME/.zshrc" ]; then
if ! grep -q 'export PATH="$HOME/bin:$PATH"' "$HOME/.zshrc"; then
echo 'export PATH="$HOME/bin:$PATH"' >> "$HOME/.zshrc"
fi
fi

fi

if [ -n "${local.encoded_post_install_script}" ]; then
echo "Running post-install script..."
echo "${local.encoded_post_install_script}" | base64 -d > /tmp/post_install.sh
chmod +x /tmp/post_install.sh
/tmp/post_install.sh
fi

if [ "${var.experiment_report_tasks}" = "true" ]; then
echo "Configuring Aider to report tasks via Coder MCP..."

mkdir -p "$HOME/.config/aider"

cat > "$HOME/.config/aider/config.yml" << EOL
${trimspace(local.combined_extensions)}
EOL
echo "Added Coder MCP extension to Aider config.yml"
fi

echo "Starting persistent Aider session..."

touch "$HOME/.aider.log"

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

export PATH="$HOME/bin:$PATH"

if [ "${var.use_tmux}" = "true" ]; then
if [ -n "${var.task_prompt}" ]; then
echo "Running Aider with message in tmux session..."

# Configure tmux for shared sessions
if [ ! -f "$HOME/.tmux.conf" ]; then
echo "Creating ~/.tmux.conf with shared session settings..."
echo "set -g mouse on" > "$HOME/.tmux.conf"
fi

if ! grep -q "^set -g mouse on$" "$HOME/.tmux.conf"; then
echo "Adding 'set -g mouse on' to ~/.tmux.conf..."
echo "set -g mouse on" >> "$HOME/.tmux.conf"
fi

echo "Starting Aider using ${var.ai_provider} provider and model: ${var.ai_model}"
tmux new-session -d -s ${var.session_name} -c ${var.folder} "export ${local.env_var_name}=\"${var.ai_api_key}\"; aider --architect --yes-always ${local.model_flag} ${var.ai_model} --message \"${local.combined_prompt}\""
echo "Aider task started in tmux session '${var.session_name}'. Check the UI for progress."
Expand All @@ -389,25 +395,25 @@ EOL
echo "Creating ~/.tmux.conf with shared session settings..."
echo "set -g mouse on" > "$HOME/.tmux.conf"
fi

if ! grep -q "^set -g mouse on$" "$HOME/.tmux.conf"; then
echo "Adding 'set -g mouse on' to ~/.tmux.conf..."
echo "set -g mouse on" >> "$HOME/.tmux.conf"
fi

echo "Starting Aider using ${var.ai_provider} provider and model: ${var.ai_model}"
tmux new-session -d -s ${var.session_name} -c ${var.folder} "export ${local.env_var_name}=\"${var.ai_api_key}\"; aider --architect --yes-always ${local.model_flag} ${var.ai_model} --message \"${var.system_prompt}\""
echo "Tmux session '${var.session_name}' started. Access it by clicking the Aider button."
fi
else
if [ -n "${var.task_prompt}" ]; then
echo "Running Aider with message in screen session..."

if [ ! -f "$HOME/.screenrc" ]; then
echo "Creating ~/.screenrc and adding multiuser settings..."
echo -e "multiuser on\nacladd $(whoami)" > "$HOME/.screenrc"
fi

if ! grep -q "^multiuser on$" "$HOME/.screenrc"; then
echo "Adding 'multiuser on' to ~/.screenrc..."
echo "multiuser on" >> "$HOME/.screenrc"
Expand All @@ -417,7 +423,7 @@ EOL
echo "Adding 'acladd $(whoami)' to ~/.screenrc..."
echo "acladd $(whoami)" >> "$HOME/.screenrc"
fi

echo "Starting Aider using ${var.ai_provider} provider and model: ${var.ai_model}"
screen -U -dmS ${var.session_name} bash -c "
cd ${var.folder}
Expand All @@ -426,15 +432,15 @@ EOL
aider --architect --yes-always ${local.model_flag} ${var.ai_model} --message \"${local.combined_prompt}\"
/bin/bash
"

echo "Aider task started in screen session '${var.session_name}'. Check the UI for progress."
else

if [ ! -f "$HOME/.screenrc" ]; then
echo "Creating ~/.screenrc and adding multiuser settings..."
echo -e "multiuser on\nacladd $(whoami)" > "$HOME/.screenrc"
fi

if ! grep -q "^multiuser on$" "$HOME/.screenrc"; then
echo "Adding 'multiuser on' to ~/.screenrc..."
echo "multiuser on" >> "$HOME/.screenrc"
Expand All @@ -444,7 +450,7 @@ EOL
echo "Adding 'acladd $(whoami)' to ~/.screenrc..."
echo "acladd $(whoami)" >> "$HOME/.screenrc"
fi

echo "Starting Aider using ${var.ai_provider} provider and model: ${var.ai_model}"
screen -U -dmS ${var.session_name} bash -c "
cd ${var.folder}
Expand All @@ -456,7 +462,7 @@ EOL
echo "Screen session '${var.session_name}' started. Access it by clicking the Aider button."
fi
fi

echo "Aider setup complete!"
EOT
run_on_start = true
Expand All @@ -471,12 +477,12 @@ resource "coder_app" "aider_cli" {
command = <<-EOT
#!/bin/bash
set -e

export PATH="$HOME/bin:$HOME/.local/bin:$PATH"

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

if [ "${var.use_tmux}" = "true" ]; then
if tmux has-session -t ${var.session_name} 2>/dev/null; then
echo "Attaching to existing Aider tmux session..."
Expand All @@ -499,4 +505,5 @@ resource "coder_app" "aider_cli" {
fi
EOT
order = var.order
group = var.group
}
14 changes: 14 additions & 0 deletions registry/coder/modules/amazon-dcv-windows/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ terraform {
}
}

variable "order" {
type = number
description = "The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order)."
default = null
}

variable "group" {
type = string
description = "The name of a group that this app belongs to."
default = null
}

variable "agent_id" {
type = string
description = "The ID of a Coder agent."
Expand Down Expand Up @@ -45,6 +57,8 @@ resource "coder_app" "web-dcv" {
url = "https://localhost:${var.port}${local.web_url_path}?username=${local.admin_username}&password=${var.admin_password}"
icon = "/icon/dcv.svg"
subdomain = var.subdomain
order = var.order
group = var.group
}

resource "coder_script" "install-dcv" {
Expand Down
24 changes: 16 additions & 8 deletions registry/coder/modules/amazon-q/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ variable "order" {
default = null
}

variable "group" {
type = string
description = "The name of a group that this app belongs to."
default = null
}

variable "icon" {
type = string
description = "The icon to use for the app."
Expand Down Expand Up @@ -213,7 +219,7 @@ resource "coder_script" "amazon_q" {
fi

if [ "${var.experiment_report_tasks}" = "true" ]; then
echo "Configuring Amazon Q to report tasks via Coder MCP..."
echo "Configuring Amazon Q to report tasks via Coder MCP..."
mkdir -p ~/.aws/amazonq
echo "${local.encoded_mcp_json}" | base64 -d > ~/.aws/amazonq/mcp.json
echo "Created the ~/.aws/amazonq/mcp.json configuration file"
Expand All @@ -227,27 +233,27 @@ resource "coder_script" "amazon_q" {

if [ "${var.experiment_use_tmux}" = "true" ]; then
echo "Running Amazon Q in the background with tmux..."

if ! command_exists tmux; then
echo "Error: tmux is not installed. Please install tmux manually."
exit 1
fi

touch "$HOME/.amazon-q.log"

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

tmux new-session -d -s amazon-q -c "${var.folder}" "q chat --trust-all-tools | tee -a "$HOME/.amazon-q.log" && exec bash"

tmux send-keys -t amazon-q "${local.full_prompt}"
sleep 5
tmux send-keys -t amazon-q Enter
fi

if [ "${var.experiment_use_screen}" = "true" ]; then
echo "Running Amazon Q in the background..."

if ! command_exists screen; then
echo "Error: screen is not installed. Please install screen manually."
exit 1
Expand All @@ -259,7 +265,7 @@ resource "coder_script" "amazon_q" {
echo "Creating ~/.screenrc and adding multiuser settings..." | tee -a "$HOME/.amazon-q.log"
echo -e "multiuser on\nacladd $(whoami)" > "$HOME/.screenrc"
fi

if ! grep -q "^multiuser on$" "$HOME/.screenrc"; then
echo "Adding 'multiuser on' to ~/.screenrc..." | tee -a "$HOME/.amazon-q.log"
echo "multiuser on" >> "$HOME/.screenrc"
Expand All @@ -271,7 +277,7 @@ resource "coder_script" "amazon_q" {
fi
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

screen -U -dmS amazon-q bash -c '
cd ${var.folder}
q chat --trust-all-tools | tee -a "$HOME/.amazon-q.log
Expand Down Expand Up @@ -326,4 +332,6 @@ resource "coder_app" "amazon_q" {
fi
EOT
icon = var.icon
order = var.order
group = var.group
}
Loading