Skip to content

fix(worktree): slugify the worktree name for docker compose - #455

Merged
lyrixx merged 1 commit into
mainfrom
fix-worktree-name-slug
Oct 15, 2026
Merged

lyrixx merged 1 commit into
mainfrom
fix-worktree-name-slug

Conversation

@JorickPepin

Copy link
Copy Markdown
Member

Bug

When a project lives in a directory with dots in its name (e.g. my.project), a worktree created next to it usually gets a name like my.project-my-feature. In that worktree, every Castor task that calls Docker Compose, like castor start, fails right away:

invalid project name "app-wt-my.project-my-feature": must consist only of lowercase alphanumeric characters, hyphens, and underscores as well as start with a letter or number

The worktree name is appended as is to the Compose project name, and Compose rejects the dots.

Fix

The worktree name is now slugified: every run of characters outside [a-z0-9] becomes a -. The worktree above now runs as app-wt-my-project-my-feature.

Warning

Underscores are replaced too: an existing worktree named my_feature becomes my-feature, so it gets new volumes and ports. Run castor stop in such worktrees before pulling this change, otherwise the old stack keeps running orphaned.

@JorickPepin
JorickPepin force-pushed the fix-worktree-name-slug branch from b143d65 to f0d039a Compare October 15, 2026 12:48
Comment thread .castor/worktree.php Outdated
Comment thread .castor/worktree.php Outdated
@JorickPepin
JorickPepin force-pushed the fix-worktree-name-slug branch from f0d039a to e68c9eb Compare October 15, 2026 13:13

@lyrixx lyrixx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@lyrixx
lyrixx merged commit c7c2186 into main Oct 15, 2026
5 checks passed
@lyrixx
lyrixx deleted the fix-worktree-name-slug branch October 15, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants