Skip to content

feat: tmux module #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jul 25, 2025
Merged

feat: tmux module #229

merged 25 commits into from
Jul 25, 2025

Conversation

35C4n0r
Copy link
Contributor

@35C4n0r 35C4n0r commented Jul 14, 2025

Closes #203
/claim #203

Description

Introduce the tmux module

Demo

https://www.loom.com/share/ec8169d34c3043f7af2163b1a1a14a4b?sid=1ea8bcb2-3db0-43ca-965a-5ed42eec3448

Type of Change

  • New module
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Module Information

Path: registry/anomaly/modules/tmux
New version: v1.0.0
Breaking change: [ ] Yes [x] No

Testing & Validation

  • Tests pass (bun test)
  • Code formatted (bun run fmt)
  • Changes tested locally

Related Issues

#203

@35C4n0r
Copy link
Contributor Author

35C4n0r commented Jul 14, 2025

@matifali please review.

@35C4n0r 35C4n0r changed the title Feat tmux feat: tmux module Jul 14, 2025
@35C4n0r
Copy link
Contributor Author

35C4n0r commented Jul 15, 2025

@DevelopmentCats let me know if this needs any changes :)

@35C4n0r
Copy link
Contributor Author

35C4n0r commented Jul 16, 2025

My bad, added frontmatter.
Can you approve the CI run again.

@bpmct
Copy link
Member

bpmct commented Jul 18, 2025

Hey - We should have clarified this in the issue, but the ability to pre-define sessions in the module via variables, then them to show up as coder_app would be the key reason I see people use this.

@35C4n0r
Copy link
Contributor Author

35C4n0r commented Jul 18, 2025

@bpmct

pre-define sessions in the module via variables

Doable 👍🏻 (1 module/session, is that what we want ?)

then them to show up as coder_app

Ok, so it will show up in the UI as a button and then we redirect them to existing terminal and start the tmux server with that session ? Can you explain the expected flow.

@35C4n0r 35C4n0r requested a review from matifali July 19, 2025 04:53
@bpmct
Copy link
Member

bpmct commented Jul 20, 2025

@bpmct

pre-define sessions in the module via variables

Doable 👍🏻 (1 module/session, is that what we want ?)

then them to show up as coder_app

Ok, so it will show up in the UI as a button and then we redirect them to existing terminal and start the tmux server with that session ? Can you explain the expected flow.

Yes. We used to do this in the claude code module. here is an example:

resource "coder_app" "claude_code" {
slug = "claude-code"
display_name = "Claude Code"
agent_id = var.agent_id
command = <<-EOT
#!/bin/bash
set -e
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
if [ "${var.experiment_use_tmux}" = "true" ]; then
if tmux has-session -t claude-code 2>/dev/null; then
echo "Attaching to existing Claude Code tmux session." | tee -a "$HOME/.claude-code.log"
tmux attach-session -t claude-code
else
echo "Starting a new Claude Code tmux session." | tee -a "$HOME/.claude-code.log"
tmux new-session -s claude-code -c ${var.folder} "claude --dangerously-skip-permissions | tee -a \"$HOME/.claude-code.log\"; exec bash"
fi
elif [ "${var.experiment_use_screen}" = "true" ]; then
if screen -list | grep -q "claude-code"; then
echo "Attaching to existing Claude Code screen session." | tee -a "$HOME/.claude-code.log"
screen -xRR claude-code
else
echo "Starting a new Claude Code screen session." | tee -a "$HOME/.claude-code.log"
screen -S claude-code bash -c 'claude --dangerously-skip-permissions | tee -a "$HOME/.claude-code.log"; exec bash'
fi
else
cd ${var.folder}
claude
fi
EOT
icon = var.icon
order = var.order
group = var.group
}

@35C4n0r
Copy link
Contributor Author

35C4n0r commented Jul 22, 2025

@bpmct @matifali made the final changes, requesting a re-review.

image

@35C4n0r 35C4n0r mentioned this pull request Jul 23, 2025
8 tasks
@35C4n0r
Copy link
Contributor Author

35C4n0r commented Jul 23, 2025

@bpmct let me know if it needs any more changes :)

@DevelopmentCats
Copy link
Contributor

DevelopmentCats commented Jul 23, 2025

@bpmct let me know if it needs any more changes :)

Can you take a look at the changes that I requested above? I know you addressed some of them like the variables in the readme and stuff but I think I had added some more in the same review below

@35C4n0r
Copy link
Contributor Author

35C4n0r commented Jul 24, 2025

@DevelopmentCats resolved all the reviews.

@35C4n0r 35C4n0r requested a review from DevelopmentCats July 24, 2025 02:26
@35C4n0r
Copy link
Contributor Author

35C4n0r commented Jul 24, 2025

@matifali @DevelopmentCats fixed the CI.

@DevelopmentCats
Copy link
Contributor

DevelopmentCats commented Jul 24, 2025

I was testing this and I actually noticed one minor issue with the README @35C4n0r

Can you add the version field to all 3 examples like it is in the first one?

Other than this minor issue, Great Work!

@35C4n0r
Copy link
Contributor Author

35C4n0r commented Jul 24, 2025

@DevelopmentCats added!
Can you hop on discord, pinging you there.

@DevelopmentCats DevelopmentCats merged commit f04d7d2 into coder:main Jul 25, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tmux session management module
4 participants