Skip to content

Commit 20d115a

Browse files
committed
feat: add some new variables
1 parent 9406c9f commit 20d115a

File tree

2 files changed

+54
-8
lines changed

2 files changed

+54
-8
lines changed

registry/coder/modules/claude-code/main.tf

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,48 @@ variable "claude_code_oauth_token" {
180180
default = ""
181181
}
182182

183+
variable "system_prompt" {
184+
type = string
185+
description = "The system prompt to use for the Claude Code server."
186+
default = "Send a task status update to notify the user that you are ready for input, and then wait for user input."
187+
}
188+
189+
variable "claude_config_path" {
190+
type = string
191+
description = "The path to the Claude config file."
192+
default = "$HOME/.claude.json"
193+
}
194+
195+
variable "claude_md_path" {
196+
type = string
197+
description = "The path to CLAUDE.md."
198+
default = "$HOME/.claude/CLAUDE.md"
199+
}
200+
201+
resource "coder_env" "claude_code_config_path" {
202+
count = var.claude_config_path == "" ? 0 : 1
203+
204+
agent_id = var.agent_id
205+
name = "CODER_MCP_CLAUDE_CONFIG_PATH"
206+
value = var.claude_config_path
207+
}
208+
209+
resource "coder_env" "claude_code_md_path" {
210+
count = var.claude_md_path == "" ? 0 : 1
211+
212+
agent_id = var.agent_id
213+
name = "CODER_MCP_CLAUDE_MD_PATH"
214+
value = var.claude_md_path
215+
}
216+
217+
resource "coder_env" "claude_code_system_prompt" {
218+
count = var.system_prompt == "" ? 0 : 1
219+
220+
agent_id = var.agent_id
221+
name = "CODER_MCP_CLAUDE_SYSTEM_PROMPT"
222+
value = var.system_prompt
223+
}
224+
183225
resource "coder_env" "claude_code_oauth_token" {
184226
agent_id = var.agent_id
185227
name = "CLAUDE_CODE_OAUTH_TOKEN"

registry/coder/modules/claude-code/scripts/install.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ function install_claude_code_cli() {
4343
fi
4444

4545
# Ensure binaries are discoverable.
46-
export PATH="$HOME/.local/bin:$PATH"
46+
echo "Creating a symlink for claude"
47+
sudo ln -s /home/coder/.local/bin/claude /usr/local/bin/claude
48+
4749
echo "Installed Claude Code successfully. Version: $(claude --version || echo 'unknown')"
4850
else
4951
echo "Skipping Claude Code installation as per configuration."
@@ -61,13 +63,15 @@ function setup_claude_configurations() {
6163
module_path="$HOME/.claude-module"
6264
mkdir -p "$module_path"
6365

64-
while IFS= read -r server_name && IFS= read -r server_json; do
65-
echo "------------------------"
66-
echo "Executing: claude mcp add \"$server_name\" '$server_json'"
67-
claude mcp add "$server_name" "$server_json"
68-
echo "------------------------"
69-
echo ""
70-
done < <(echo "${ARG_MCP:-{}}" | jq -r '.mcpServers | to_entries[] | .key, (.value | @json)')
66+
if [ "$ARG_MCP" != "" ]; then
67+
while IFS= read -r server_name && IFS= read -r server_json; do
68+
echo "------------------------"
69+
echo "Executing: claude mcp add \"$server_name\" '$server_json'"
70+
claude mcp add "$server_name" "$server_json"
71+
echo "------------------------"
72+
echo ""
73+
done < <(echo "$ARG_MCP" | jq -r '.mcpServers | to_entries[] | .key, (.value | @json)')
74+
fi
7175

7276
if [ -n "$ARG_ALLOWED_TOOLS" ]; then
7377
coder --allowedTools "$ARG_ALLOWED_TOOLS"

0 commit comments

Comments
 (0)