feat: add port allocation for task worktrees#104
Merged
Conversation
Each task now gets a unique port (from range 3100-4099) allocated when its worktree is set up. This enables running applications in isolation without port conflicts between concurrent tasks. Environment variables passed to Claude: - TASK_ID: Task identifier for hooks - TASK_PORT: Unique port for running the application - TASK_WORKTREE_PATH: Path to the task's git worktree Applications can use these environment variables to: - Boot on the unique port (e.g., PORT=$TASK_PORT bin/dev) - Configure isolated databases (e.g., myapp_db_$TASK_ID) - Avoid conflicts with other running task worktrees Ports are reused when tasks are marked as done. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
62d33d1 to
239998a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TASK_ID,TASK_PORT,TASK_WORKTREE_PATH) to Claude when executing tasksTest plan
$TASK_PORT🤖 Generated with Claude Code