From 13e1966052827ff2585761d8ea364b826a01428e Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Tue, 9 Dec 2025 22:42:49 +0530 Subject: [PATCH 01/13] chore(coder/modules/claude-code): use $HOME variable instead of hardcoded path in symlink creation --- registry/coder/modules/claude-code/scripts/install.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/registry/coder/modules/claude-code/scripts/install.sh b/registry/coder/modules/claude-code/scripts/install.sh index ba4420fa3..db381b894 100644 --- a/registry/coder/modules/claude-code/scripts/install.sh +++ b/registry/coder/modules/claude-code/scripts/install.sh @@ -1,9 +1,5 @@ #!/bin/bash -if [ -f "$HOME/.bashrc" ]; then - source "$HOME"/.bashrc -fi - # Set strict error handling AFTER sourcing bashrc to avoid unbound variable errors from user dotfiles set -euo pipefail @@ -48,7 +44,7 @@ function install_claude_code_cli() { # Ensure binaries are discoverable. echo "Creating a symlink for claude" - sudo ln -s /home/coder/.local/bin/claude /usr/local/bin/claude + ln -s "${HOME}"/.local/bin/claude /usr/local/bin/claude echo "Installed Claude Code successfully. Version: $(claude --version || echo 'unknown')" else From 8766ec2dc94c5ed113d63e8c3eb18c1a4e4ebd1c Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Tue, 9 Dec 2025 23:25:33 +0530 Subject: [PATCH 02/13] fix: fix test path --- registry/coder/modules/claude-code/main.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/claude-code/main.test.ts b/registry/coder/modules/claude-code/main.test.ts index 6e37501da..527bd1889 100644 --- a/registry/coder/modules/claude-code/main.test.ts +++ b/registry/coder/modules/claude-code/main.test.ts @@ -141,7 +141,7 @@ describe("claude-code", async () => { }); await execModuleScript(id); - const resp = await readFileContainer(id, "/home/coder/.claude.json"); + const resp = await readFileContainer(id, "$HOME/.claude.json"); expect(resp).toContain("test-cmd"); }); From d4e553e55aae7f71b0e10a853ad20583965fed9a Mon Sep 17 00:00:00 2001 From: 35C4n0r <70096901+35C4n0r@users.noreply.github.com> Date: Tue, 9 Dec 2025 23:52:35 +0530 Subject: [PATCH 03/13] revert --- registry/coder/modules/claude-code/main.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/claude-code/main.test.ts b/registry/coder/modules/claude-code/main.test.ts index 527bd1889..6e37501da 100644 --- a/registry/coder/modules/claude-code/main.test.ts +++ b/registry/coder/modules/claude-code/main.test.ts @@ -141,7 +141,7 @@ describe("claude-code", async () => { }); await execModuleScript(id); - const resp = await readFileContainer(id, "$HOME/.claude.json"); + const resp = await readFileContainer(id, "/home/coder/.claude.json"); expect(resp).toContain("test-cmd"); }); From 973645f54c659087cf8a3c959497951ccfbcd3cb Mon Sep 17 00:00:00 2001 From: DevelopmentCats Date: Tue, 9 Dec 2025 14:01:35 -0600 Subject: [PATCH 04/13] chore(claude-code): update install script to include PATH export and remove symlink creation --- registry/coder/modules/claude-code/scripts/install.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/registry/coder/modules/claude-code/scripts/install.sh b/registry/coder/modules/claude-code/scripts/install.sh index db381b894..58c26ac3b 100644 --- a/registry/coder/modules/claude-code/scripts/install.sh +++ b/registry/coder/modules/claude-code/scripts/install.sh @@ -3,6 +3,9 @@ # Set strict error handling AFTER sourcing bashrc to avoid unbound variable errors from user dotfiles set -euo pipefail +# Ensure claude binary is in PATH +export PATH="$HOME/.local/bin:$PATH" + BOLD='\033[0;1m' command_exists() { @@ -42,10 +45,6 @@ function install_claude_code_cli() { echo "Claude Code installer failed with exit code $$CURL_EXIT" fi - # Ensure binaries are discoverable. - echo "Creating a symlink for claude" - ln -s "${HOME}"/.local/bin/claude /usr/local/bin/claude - echo "Installed Claude Code successfully. Version: $(claude --version || echo 'unknown')" else echo "Skipping Claude Code installation as per configuration." From d72b4efae0c3413844c10a1eff509aca9163ee3b Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Wed, 10 Dec 2025 16:57:28 +0530 Subject: [PATCH 05/13] revert if wrong --- registry/coder/modules/claude-code/main.tf | 6 ++++++ registry/coder/modules/claude-code/scripts/install.sh | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/registry/coder/modules/claude-code/main.tf b/registry/coder/modules/claude-code/main.tf index bef2a219e..5edc742d9 100644 --- a/registry/coder/modules/claude-code/main.tf +++ b/registry/coder/modules/claude-code/main.tf @@ -288,6 +288,12 @@ resource "coder_env" "disable_autoupdater" { value = "1" } +resource "coder_env" "claude_binary_path" { + agent_id = var.agent_id + name = "PATH" + value = "$HOME/.local/bin:$PATH" +} + locals { # we have to trim the slash because otherwise coder exp mcp will # set up an invalid claude config diff --git a/registry/coder/modules/claude-code/scripts/install.sh b/registry/coder/modules/claude-code/scripts/install.sh index 58c26ac3b..702862b21 100644 --- a/registry/coder/modules/claude-code/scripts/install.sh +++ b/registry/coder/modules/claude-code/scripts/install.sh @@ -4,7 +4,7 @@ set -euo pipefail # Ensure claude binary is in PATH -export PATH="$HOME/.local/bin:$PATH" +#export PATH="$HOME/.local/bin:$PATH" BOLD='\033[0;1m' @@ -44,7 +44,6 @@ function install_claude_code_cli() { if [ $CURL_EXIT -ne 0 ]; then echo "Claude Code installer failed with exit code $$CURL_EXIT" fi - echo "Installed Claude Code successfully. Version: $(claude --version || echo 'unknown')" else echo "Skipping Claude Code installation as per configuration." From 722bb8e498e30e1998e6dca834162964f503c735 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Wed, 10 Dec 2025 17:02:30 +0530 Subject: [PATCH 06/13] revert if wrong --- registry/coder/modules/claude-code/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/claude-code/main.tf b/registry/coder/modules/claude-code/main.tf index 5edc742d9..7dafa9e3a 100644 --- a/registry/coder/modules/claude-code/main.tf +++ b/registry/coder/modules/claude-code/main.tf @@ -291,7 +291,7 @@ resource "coder_env" "disable_autoupdater" { resource "coder_env" "claude_binary_path" { agent_id = var.agent_id name = "PATH" - value = "$HOME/.local/bin:$PATH" + value = "$HOME/.local/jaykumar:$PATH" } locals { From eb08e448779fbf7fd12efa548d5cb612a0f86fee Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Wed, 10 Dec 2025 17:26:57 +0530 Subject: [PATCH 07/13] feat: add $HOME/.local/bin to PATH using coder_env --- registry/coder/modules/claude-code/main.tf | 6 +++--- registry/coder/modules/claude-code/scripts/install.sh | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/registry/coder/modules/claude-code/main.tf b/registry/coder/modules/claude-code/main.tf index 7dafa9e3a..8531a9f9a 100644 --- a/registry/coder/modules/claude-code/main.tf +++ b/registry/coder/modules/claude-code/main.tf @@ -289,9 +289,9 @@ resource "coder_env" "disable_autoupdater" { } resource "coder_env" "claude_binary_path" { - agent_id = var.agent_id - name = "PATH" - value = "$HOME/.local/jaykumar:$PATH" + agent_id = var.agent_id + name = "PATH" + value = "$HOME/.local/bin:$PATH" } locals { diff --git a/registry/coder/modules/claude-code/scripts/install.sh b/registry/coder/modules/claude-code/scripts/install.sh index 702862b21..15981e8b5 100644 --- a/registry/coder/modules/claude-code/scripts/install.sh +++ b/registry/coder/modules/claude-code/scripts/install.sh @@ -1,11 +1,7 @@ #!/bin/bash -# Set strict error handling AFTER sourcing bashrc to avoid unbound variable errors from user dotfiles set -euo pipefail -# Ensure claude binary is in PATH -#export PATH="$HOME/.local/bin:$PATH" - BOLD='\033[0;1m' command_exists() { From 7672178d60580c354cd623e34f0bf78d2015e133 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Fri, 12 Dec 2025 12:19:21 +0000 Subject: [PATCH 08/13] feat: remove export and source from start script Signed-off-by: 35C4n0r --- registry/coder/modules/claude-code/scripts/start.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/registry/coder/modules/claude-code/scripts/start.sh b/registry/coder/modules/claude-code/scripts/start.sh index 93ff4f723..ebca736cc 100644 --- a/registry/coder/modules/claude-code/scripts/start.sh +++ b/registry/coder/modules/claude-code/scripts/start.sh @@ -1,14 +1,7 @@ #!/bin/bash -if [ -f "$HOME/.bashrc" ]; then - source "$HOME"/.bashrc -fi - -# Set strict error handling AFTER sourcing bashrc to avoid unbound variable errors from user dotfiles set -euo pipefail -export PATH="$HOME/.local/bin:$PATH" - command_exists() { command -v "$1" > /dev/null 2>&1 } From 807b4c0cb1c976997ea52e0c4c6ea42cbb46a2dc Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Fri, 12 Dec 2025 13:42:58 +0000 Subject: [PATCH 09/13] feat: update tests Signed-off-by: 35C4n0r --- .../coder/modules/claude-code/main.test.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/registry/coder/modules/claude-code/main.test.ts b/registry/coder/modules/claude-code/main.test.ts index 6e37501da..c62493cf8 100644 --- a/registry/coder/modules/claude-code/main.test.ts +++ b/registry/coder/modules/claude-code/main.test.ts @@ -39,9 +39,11 @@ interface SetupProps { agentapiMockScript?: string; } -const setup = async (props?: SetupProps): Promise<{ id: string }> => { +const setup = async ( + props?: SetupProps, +): Promise<{ id: string; coderEnvVars: Record }> => { const projectDir = "/home/coder/project"; - const { id } = await setupUtil({ + const { id, coderEnvVars } = await setupUtil({ moduleDir: import.meta.dir, moduleVariables: { install_claude_code: props?.skipClaudeMock ? "true" : "false", @@ -61,7 +63,7 @@ const setup = async (props?: SetupProps): Promise<{ id: string }> => { content: await loadTestFile(import.meta.dir, "claude-mock.sh"), }); } - return { id }; + return { id, coderEnvVars }; }; setDefaultTimeout(60 * 1000); @@ -79,14 +81,14 @@ describe("claude-code", async () => { test("install-claude-code-version", async () => { const version_to_install = "1.0.40"; - const { id } = await setup({ + const { id, coderEnvVars } = await setup({ skipClaudeMock: true, moduleVariables: { install_claude_code: "true", claude_code_version: version_to_install, }, }); - await execModuleScript(id); + await execModuleScript(id, coderEnvVars); const resp = await execContainer(id, [ "bash", "-c", @@ -96,14 +98,14 @@ describe("claude-code", async () => { }); test("check-latest-claude-code-version-works", async () => { - const { id } = await setup({ + const { id, coderEnvVars } = await setup({ skipClaudeMock: true, skipAgentAPIMock: true, moduleVariables: { install_claude_code: "true", }, }); - await execModuleScript(id); + await execModuleScript(id, coderEnvVars); await expectAgentAPIStarted(id); }); @@ -133,13 +135,13 @@ describe("claude-code", async () => { }, }, }); - const { id } = await setup({ + const { id, coderEnvVars } = await setup({ skipClaudeMock: true, moduleVariables: { mcp: mcpConfig, }, }); - await execModuleScript(id); + await execModuleScript(id, coderEnvVars); const resp = await readFileContainer(id, "/home/coder/.claude.json"); expect(resp).toContain("test-cmd"); From 49a5d24db268c6775cc0d3fffcc399062285bc4c Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Fri, 12 Dec 2025 13:49:02 +0000 Subject: [PATCH 10/13] chore: bump version Signed-off-by: 35C4n0r --- registry/coder/modules/claude-code/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index 657435f96..aa1e2d26f 100644 --- a/registry/coder/modules/claude-code/README.md +++ b/registry/coder/modules/claude-code/README.md @@ -13,7 +13,7 @@ Run the [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude ```tf module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "4.2.6" + version = "4.2.7" agent_id = coder_agent.main.id workdir = "/home/coder/project" claude_api_key = "xxxx-xxxxx-xxxx" @@ -45,7 +45,7 @@ This example shows how to configure the Claude Code module to run the agent behi ```tf module "claude-code" { source = "dev.registry.coder.com/coder/claude-code/coder" - version = "4.2.6" + version = "4.2.7" agent_id = coder_agent.main.id workdir = "/home/coder/project" enable_boundary = true @@ -72,7 +72,7 @@ data "coder_parameter" "ai_prompt" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "4.2.6" + version = "4.2.7" agent_id = coder_agent.main.id workdir = "/home/coder/project" @@ -109,7 +109,7 @@ Run and configure Claude Code as a standalone CLI in your workspace. ```tf module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "4.2.6" + version = "4.2.7" agent_id = coder_agent.main.id workdir = "/home/coder/project" install_claude_code = true @@ -131,7 +131,7 @@ variable "claude_code_oauth_token" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "4.2.6" + version = "4.2.7" agent_id = coder_agent.main.id workdir = "/home/coder/project" claude_code_oauth_token = var.claude_code_oauth_token @@ -204,7 +204,7 @@ resource "coder_env" "bedrock_api_key" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "4.2.6" + version = "4.2.7" agent_id = coder_agent.main.id workdir = "/home/coder/project" model = "global.anthropic.claude-sonnet-4-5-20250929-v1:0" @@ -261,7 +261,7 @@ resource "coder_env" "google_application_credentials" { module "claude-code" { source = "registry.coder.com/coder/claude-code/coder" - version = "4.2.6" + version = "4.2.7" agent_id = coder_agent.main.id workdir = "/home/coder/project" model = "claude-sonnet-4@20250514" From 7dc6c2ac45dc76a134c8a6d05224e07501878b62 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Fri, 12 Dec 2025 13:52:40 +0000 Subject: [PATCH 11/13] chore: bump module versions (patch) Signed-off-by: 35C4n0r --- registry/coder/modules/claude-code/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index aa1e2d26f..6f8539a22 100644 --- a/registry/coder/modules/claude-code/README.md +++ b/registry/coder/modules/claude-code/README.md @@ -96,6 +96,7 @@ module "claude-code" { "args": ["--port", "8080"] } + } } EOF From 5529be6936214659ca40767e82c0d9798cc37e71 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Fri, 12 Dec 2025 16:20:42 +0000 Subject: [PATCH 12/13] chore: add comma Signed-off-by: 35C4n0r --- registry/coder/modules/claude-code/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index 6f8539a22..3445a5f6e 100644 --- a/registry/coder/modules/claude-code/README.md +++ b/registry/coder/modules/claude-code/README.md @@ -92,7 +92,7 @@ module "claude-code" { { "mcpServers": { "my-custom-tool": { - "command": "my-tool-server" + "command": "my-tool-server", "args": ["--port", "8080"] } From 52700df3ea184c35f44acd7059fb231294c17415 Mon Sep 17 00:00:00 2001 From: 35C4n0r <70096901+35C4n0r@users.noreply.github.com> Date: Sun, 14 Dec 2025 14:09:30 +0530 Subject: [PATCH 13/13] Update README.md --- registry/coder/modules/claude-code/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/registry/coder/modules/claude-code/README.md b/registry/coder/modules/claude-code/README.md index 3445a5f6e..11172010f 100644 --- a/registry/coder/modules/claude-code/README.md +++ b/registry/coder/modules/claude-code/README.md @@ -95,8 +95,6 @@ module "claude-code" { "command": "my-tool-server", "args": ["--port", "8080"] } - - } } EOF