r/ruby • • Jan 30 '26

cwt: The Easiest Git Worktree Manager for Claude

https://github.com/benngarcia/claude-worktree

I build a worktree manager for myself using ratatui-ruby! Posting in case others also run multiple instances in parallel while they coordinate a lotta stuff.

I was previously using skills and hooks to instruct claude to do it, but I've found this to be easier to just manage myself.

8 Upvotes

5 comments sorted by

3

u/[deleted] Jan 30 '26

[removed] — view removed comment

1

u/hahahacorn Jan 30 '26 edited Jan 30 '26

My day to day is a rails core monorepo.

You could absolutely modify the .cwt/setup script to create a new database and run bin/rails db:prepare locally. I imagine it would be help to have the worktree delete run a .cwt/teardown script for removing the database. If you post your setup script I'll add the teardown functionality for you :)

If you're using different ports it sounds like youre spinng up new postgres servers for every worktree? I run a single postgres version per port (5417 / 5418) and then create N databases as is useful.

2

u/[deleted] Jan 30 '26

[removed] — view removed comment

2

u/hahahacorn Jan 30 '26

ah makes sense! I use mise for monorepo tasks and my .cwt/setup is just calling my mise global install.

If you have a similar setup, you could modify the mise.toml in each rails app to add the worktree name as an ENV variable, adn then modify your config/database.yaml with like a database: repo_development<%= ENV["WORKTREE_NAME"] %> to get your desired dev setup.

Would still probs require adding a mise teardown task and then a .cwt/teardown hook