Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit ac9e3f5

Browse files
authored
Merge branch 'main' into windsurf
2 parents 467d3f3 + 4b4ceba commit ac9e3f5

File tree

18 files changed

+692
-182
lines changed

18 files changed

+692
-182
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,3 @@ jobs:
5353
config: .github/typos.toml
5454
- name: Lint
5555
run: bun lint
56-
# Disable version check until https://github.com/coder/modules/pull/426 is merged.
57-
# This will allow us to use separate versioning for each module without failing CI. The backend already supports that.
58-
# - name: Check version
59-
# shell: bash
60-
# run: |
61-
# # check for version changes
62-
# ./update-version.sh
63-
# # Check if any changes were made in README.md files
64-
# if [[ -n "$(git status --porcelain -- '**/README.md')" ]]; then
65-
# echo "Version mismatch detected. Please run ./update-version.sh and commit the updated README.md files."
66-
# git diff -- '**/README.md'
67-
# exit 1
68-
# else
69-
# echo "No version mismatch detected. All versions are up to date."
70-
# fi

.github/workflows/deploy-registry.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- "release/*/v*" # Matches tags like release/module-name/v1.0.0
79

810
jobs:
911
deploy:
@@ -34,4 +36,4 @@ jobs:
3436
- name: Deploy to dev.registry.coder.com
3537
run: |
3638
gcloud builds triggers run 29818181-126d-4f8a-a937-f228b27d3d34 --branch dev
37-
39+

CONTRIBUTING.md

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Follow the instructions to ensure that Bun is available globally. Once Bun has b
2222

2323
## Testing a Module
2424

25-
> **Note:** It is the responsibility of the module author to implement tests for their module. The author must test the module locally before submitting a PR.
25+
> [!NOTE]
26+
> It is the responsibility of the module author to implement tests for their module. The author must test the module locally before submitting a PR.
2627
2728
A suite of test-helpers exists to run `terraform apply` on modules with variables, and test script output against containers.
2829

@@ -53,23 +54,44 @@ module "example" {
5354

5455
## Releases
5556

56-
> [!WARNING]
57-
> When creating a new release, make sure that your new version number is fully accurate. If a version number is incorrect or does not exist, we may end up serving incorrect/old data for our various tools and providers.
57+
The release process is automated with these steps:
58+
59+
## 1. Create and Merge PR
60+
61+
- Create a PR with your module changes
62+
- Get your PR reviewed, approved, and merged to `main`
63+
64+
## 2. Prepare Release (Maintainer Task)
65+
66+
After merging to `main`, a maintainer will:
67+
68+
- View all modules and their current versions:
69+
70+
```shell
71+
./release.sh --list
72+
```
73+
74+
- Determine the next version number based on changes:
75+
76+
- **Patch version** (1.2.3 → 1.2.4): Bug fixes
77+
- **Minor version** (1.2.3 → 1.3.0): New features, adding inputs, deprecating inputs
78+
- **Major version** (1.2.3 → 2.0.0): Breaking changes (removing inputs, changing input types)
5879

59-
Much of our release process is automated. To cut a new release:
80+
- Create and push an annotated tag:
6081

61-
1. Navigate to [GitHub's Releases page](https://github.com/coder/modules/releases)
62-
2. Click "Draft a new release"
63-
3. Click the "Choose a tag" button and type a new release number in the format `v<major>.<minor>.<patch>` (e.g., `v1.18.0`). Then click "Create new tag".
64-
4. Click the "Generate release notes" button, and clean up the resulting README. Be sure to remove any notes that would not be relevant to end-users (e.g., bumping dependencies).
65-
5. Once everything looks good, click the "Publish release" button.
82+
```shell
83+
# Fetch latest changes
84+
git fetch origin
85+
86+
# Create and push tag
87+
./release.sh module-name 1.2.3 --push
88+
```
6689

67-
Once the release has been cut, a script will run to check whether there are any modules that will require that the new release number be published to Terraform. If there are any, a new pull request will automatically be generated. Be sure to approve this PR and merge it into the `main` branch.
90+
The tag format will be: `release/module-name/v1.2.3`
6891

69-
Following that, our automated processes will handle publishing new data for [`registry.coder.com`](https://github.com/coder/registry.coder.com/):
92+
## 3. Publishing to Registry
7093

71-
1. Publishing new versions to Coder's [Terraform Registry](https://registry.terraform.io/providers/coder/coder/latest)
72-
2. Publishing new data to the [Coder Registry](https://registry.coder.com)
94+
Our automated processes will handle publishing new data to [registry.coder.com](https://registry.coder.com).
7395

7496
> [!NOTE]
75-
> Some data in `registry.coder.com` is fetched on demand from the Module repo's main branch. This data should be updated almost immediately after a new release, but other changes will take some time to propagate.
97+
> Some data in registry.coder.com is fetched on demand from the [coder/modules](https://github.com/coder/modules) repo's `main` branch. This data should update almost immediately after a release, while other changes will take some time to propagate.

claude-code/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Run the [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude
1414
```tf
1515
module "claude-code" {
1616
source = "registry.coder.com/modules/claude-code/coder"
17-
version = "1.0.31"
17+
version = "1.2.0"
1818
agent_id = coder_agent.example.id
1919
folder = "/home/coder"
2020
install_claude_code = true
@@ -25,7 +25,7 @@ module "claude-code" {
2525
### Prerequisites
2626

2727
- Node.js and npm must be installed in your workspace to install Claude Code
28-
- `screen` must be installed in your workspace to run Claude Code in the background
28+
- Either `screen` or `tmux` must be installed in your workspace to run Claude Code in the background
2929
- You must add the [Coder Login](https://registry.coder.com/modules/coder-login) module to your template
3030

3131
The `codercom/oss-dogfood:latest` container image can be used for testing on container-based workspaces.
@@ -43,7 +43,7 @@ The `codercom/oss-dogfood:latest` container image can be used for testing on con
4343
> Join our [Discord channel](https://discord.gg/coder) or
4444
> [contact us](https://coder.com/contact) to get help or share feedback.
4545
46-
Your workspace must have `screen` installed to use this.
46+
Your workspace must have either `screen` or `tmux` installed to use this.
4747

4848
```tf
4949
variable "anthropic_api_key" {
@@ -71,7 +71,7 @@ data "coder_parameter" "ai_prompt" {
7171
resource "coder_agent" "main" {
7272
# ...
7373
env = {
74-
CODER_MCP_CLAUDE_API_KEY = var.anthropic_api_key # or use a coder_parameter
74+
CODER_MCP_CLAUDE_API_KEY = var.anthropic_api_key # or use a coder_parameter
7575
CODER_MCP_CLAUDE_TASK_PROMPT = data.coder_parameter.ai_prompt.value
7676
CODER_MCP_APP_STATUS_SLUG = "claude-code"
7777
CODER_MCP_CLAUDE_SYSTEM_PROMPT = <<-EOT
@@ -83,14 +83,14 @@ resource "coder_agent" "main" {
8383
module "claude-code" {
8484
count = data.coder_workspace.me.start_count
8585
source = "registry.coder.com/modules/claude-code/coder"
86-
version = "1.0.31"
86+
version = "1.1.0"
8787
agent_id = coder_agent.example.id
8888
folder = "/home/coder"
8989
install_claude_code = true
9090
claude_code_version = "0.2.57"
9191
9292
# Enable experimental features
93-
experiment_use_screen = true
93+
experiment_use_screen = true # Or use experiment_use_tmux = true to use tmux instead
9494
experiment_report_tasks = true
9595
}
9696
```
@@ -102,7 +102,7 @@ Run Claude Code as a standalone app in your workspace. This will install Claude
102102
```tf
103103
module "claude-code" {
104104
source = "registry.coder.com/modules/claude-code/coder"
105-
version = "1.0.31"
105+
version = "1.2.0"
106106
agent_id = coder_agent.example.id
107107
folder = "/home/coder"
108108
install_claude_code = true

claude-code/main.tf

Lines changed: 87 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,35 @@ variable "experiment_use_screen" {
5454
default = false
5555
}
5656

57+
variable "experiment_use_tmux" {
58+
type = bool
59+
description = "Whether to use tmux instead of screen for running Claude Code in the background."
60+
default = false
61+
}
62+
5763
variable "experiment_report_tasks" {
5864
type = bool
5965
description = "Whether to enable task reporting."
6066
default = false
6167
}
6268

69+
variable "experiment_pre_install_script" {
70+
type = string
71+
description = "Custom script to run before installing Claude Code."
72+
default = null
73+
}
74+
75+
variable "experiment_post_install_script" {
76+
type = string
77+
description = "Custom script to run after installing Claude Code."
78+
default = null
79+
}
80+
81+
locals {
82+
encoded_pre_install_script = var.experiment_pre_install_script != null ? base64encode(var.experiment_pre_install_script) : ""
83+
encoded_post_install_script = var.experiment_post_install_script != null ? base64encode(var.experiment_post_install_script) : ""
84+
}
85+
6386
# Install and Initialize Claude Code
6487
resource "coder_script" "claude_code" {
6588
agent_id = var.agent_id
@@ -74,6 +97,14 @@ resource "coder_script" "claude_code" {
7497
command -v "$1" >/dev/null 2>&1
7598
}
7699
100+
# Run pre-install script if provided
101+
if [ -n "${local.encoded_pre_install_script}" ]; then
102+
echo "Running pre-install script..."
103+
echo "${local.encoded_pre_install_script}" | base64 -d > /tmp/pre_install.sh
104+
chmod +x /tmp/pre_install.sh
105+
/tmp/pre_install.sh
106+
fi
107+
77108
# Install Claude Code if enabled
78109
if [ "${var.install_claude_code}" = "true" ]; then
79110
if ! command_exists npm; then
@@ -84,11 +115,52 @@ resource "coder_script" "claude_code" {
84115
npm install -g @anthropic-ai/claude-code@${var.claude_code_version}
85116
fi
86117
118+
# Run post-install script if provided
119+
if [ -n "${local.encoded_post_install_script}" ]; then
120+
echo "Running post-install script..."
121+
echo "${local.encoded_post_install_script}" | base64 -d > /tmp/post_install.sh
122+
chmod +x /tmp/post_install.sh
123+
/tmp/post_install.sh
124+
fi
125+
87126
if [ "${var.experiment_report_tasks}" = "true" ]; then
88127
echo "Configuring Claude Code to report tasks via Coder MCP..."
89128
coder exp mcp configure claude-code ${var.folder}
90129
fi
91130
131+
# Handle terminal multiplexer selection (tmux or screen)
132+
if [ "${var.experiment_use_tmux}" = "true" ] && [ "${var.experiment_use_screen}" = "true" ]; then
133+
echo "Error: Both experiment_use_tmux and experiment_use_screen cannot be true simultaneously."
134+
echo "Please set only one of them to true."
135+
exit 1
136+
fi
137+
138+
# Run with tmux if enabled
139+
if [ "${var.experiment_use_tmux}" = "true" ]; then
140+
echo "Running Claude Code in the background with tmux..."
141+
142+
# Check if tmux is installed
143+
if ! command_exists tmux; then
144+
echo "Error: tmux is not installed. Please install tmux manually."
145+
exit 1
146+
fi
147+
148+
touch "$HOME/.claude-code.log"
149+
150+
export LANG=en_US.UTF-8
151+
export LC_ALL=en_US.UTF-8
152+
153+
# Create a new tmux session in detached mode
154+
tmux new-session -d -s claude-code -c ${var.folder} "claude"
155+
156+
# Send the prompt to the tmux session if needed
157+
if [ -n "$CODER_MCP_CLAUDE_TASK_PROMPT" ]; then
158+
tmux send-keys -t claude-code "$CODER_MCP_CLAUDE_TASK_PROMPT"
159+
sleep 5
160+
tmux send-keys -t claude-code Enter
161+
fi
162+
fi
163+
92164
# Run with screen if enabled
93165
if [ "${var.experiment_use_screen}" = "true" ]; then
94166
echo "Running Claude Code in the background..."
@@ -149,20 +221,27 @@ resource "coder_app" "claude_code" {
149221
#!/bin/bash
150222
set -e
151223
152-
if [ "${var.experiment_use_screen}" = "true" ]; then
224+
export LANG=en_US.UTF-8
225+
export LC_ALL=en_US.UTF-8
226+
227+
if [ "${var.experiment_use_tmux}" = "true" ]; then
228+
if tmux has-session -t claude-code 2>/dev/null; then
229+
echo "Attaching to existing Claude Code tmux session." | tee -a "$HOME/.claude-code.log"
230+
tmux attach-session -t claude-code
231+
else
232+
echo "Starting a new Claude Code tmux session." | tee -a "$HOME/.claude-code.log"
233+
tmux new-session -s claude-code -c ${var.folder} "claude --dangerously-skip-permissions | tee -a \"$HOME/.claude-code.log\"; exec bash"
234+
fi
235+
elif [ "${var.experiment_use_screen}" = "true" ]; then
153236
if screen -list | grep -q "claude-code"; then
154-
export LANG=en_US.UTF-8
155-
export LC_ALL=en_US.UTF-8
156-
echo "Attaching to existing Claude Code session." | tee -a "$HOME/.claude-code.log"
237+
echo "Attaching to existing Claude Code screen session." | tee -a "$HOME/.claude-code.log"
157238
screen -xRR claude-code
158239
else
159-
echo "Starting a new Claude Code session." | tee -a "$HOME/.claude-code.log"
160-
screen -S claude-code bash -c 'export LANG=en_US.UTF-8; export LC_ALL=en_US.UTF-8; claude --dangerously-skip-permissions | tee -a "$HOME/.claude-code.log"; exec bash'
240+
echo "Starting a new Claude Code screen session." | tee -a "$HOME/.claude-code.log"
241+
screen -S claude-code bash -c 'claude --dangerously-skip-permissions | tee -a "$HOME/.claude-code.log"; exec bash'
161242
fi
162243
else
163244
cd ${var.folder}
164-
export LANG=en_US.UTF-8
165-
export LC_ALL=en_US.UTF-8
166245
claude
167246
fi
168247
EOT

code-server/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Automatically install [code-server](https://github.com/coder/code-server) in a w
1515
module "code-server" {
1616
count = data.coder_workspace.me.start_count
1717
source = "registry.coder.com/modules/code-server/coder"
18-
version = "1.0.31"
18+
version = "1.1.0"
1919
agent_id = coder_agent.example.id
2020
}
2121
```
@@ -30,7 +30,7 @@ module "code-server" {
3030
module "code-server" {
3131
count = data.coder_workspace.me.start_count
3232
source = "registry.coder.com/modules/code-server/coder"
33-
version = "1.0.31"
33+
version = "1.1.0"
3434
agent_id = coder_agent.example.id
3535
install_version = "4.8.3"
3636
}
@@ -44,7 +44,7 @@ Install the Dracula theme from [OpenVSX](https://open-vsx.org/):
4444
module "code-server" {
4545
count = data.coder_workspace.me.start_count
4646
source = "registry.coder.com/modules/code-server/coder"
47-
version = "1.0.31"
47+
version = "1.1.0"
4848
agent_id = coder_agent.example.id
4949
extensions = [
5050
"dracula-theme.theme-dracula"
@@ -62,7 +62,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte
6262
module "code-server" {
6363
count = data.coder_workspace.me.start_count
6464
source = "registry.coder.com/modules/code-server/coder"
65-
version = "1.0.31"
65+
version = "1.1.0"
6666
agent_id = coder_agent.example.id
6767
extensions = ["dracula-theme.theme-dracula"]
6868
settings = {
@@ -79,7 +79,7 @@ Just run code-server in the background, don't fetch it from GitHub:
7979
module "code-server" {
8080
count = data.coder_workspace.me.start_count
8181
source = "registry.coder.com/modules/code-server/coder"
82-
version = "1.0.31"
82+
version = "1.1.0"
8383
agent_id = coder_agent.example.id
8484
extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
8585
}
@@ -95,7 +95,7 @@ Run an existing copy of code-server if found, otherwise download from GitHub:
9595
module "code-server" {
9696
count = data.coder_workspace.me.start_count
9797
source = "registry.coder.com/modules/code-server/coder"
98-
version = "1.0.31"
98+
version = "1.1.0"
9999
agent_id = coder_agent.example.id
100100
use_cached = true
101101
extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
@@ -108,7 +108,7 @@ Just run code-server in the background, don't fetch it from GitHub:
108108
module "code-server" {
109109
count = data.coder_workspace.me.start_count
110110
source = "registry.coder.com/modules/code-server/coder"
111-
version = "1.0.31"
111+
version = "1.1.0"
112112
agent_id = coder_agent.example.id
113113
offline = true
114114
}

0 commit comments

Comments
 (0)