fix: make worktree target subagent-friendly with NAME parameter#126
Merged
JacobCoffee merged 1 commit intomainfrom Nov 23, 2025
Merged
fix: make worktree target subagent-friendly with NAME parameter#126JacobCoffee merged 1 commit intomainfrom
JacobCoffee merged 1 commit intomainfrom
Conversation
Previously, `make worktree` used an interactive `read` prompt that failed for subagents (resulting in invalid branch name `feature/`). Now supports: - Non-interactive: `make worktree NAME=my-feature` (for subagents) - Interactive: `make worktree` (prompts for name, backward compatible) - Validation: Fails gracefully if name is empty with helpful error message This allows subagents to create worktrees without manual intervention while maintaining the interactive experience for human developers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates the Makefile's worktree target to support a non-interactive NAME parameter while preserving interactive behavior and adding validation/error messaging for empty feature names. Sequence diagram for updated make worktree target with NAME parametersequenceDiagram
title "Sequence diagram for updated make worktree target with NAME parameter"
actor "Developer"
participant "make"
participant "shell"
participant "git"
"Developer"->>"make": "Invoke 'make worktree [NAME=my-feature]'"
"make"->>"shell": "Execute 'worktree' target commands"
alt "NAME parameter is provided"
"shell"->>"shell": "Set 'name' from '$(NAME)'"
else "NAME parameter is not provided"
"shell"->>"Developer": "Prompt 'Feature name: '"
"Developer"-->>"shell": "Enter feature name"
end
"shell"->>"shell": "Check if 'name' is empty"
alt "Name is empty"
"shell"-->>"Developer": "Print 'ERROR: Feature name cannot be empty'"
"shell"-->>"Developer": "Print 'Usage: make worktree NAME=my-feature'"
"shell"->>"shell": "Exit with status 1"
else "Name is not empty"
"shell"->>"git": "git checkout main"
"git"-->>"shell": "'main' checked out"
"shell"->>"git": "git pull"
"git"-->>"shell": "Repository updated"
"shell"->>"git": "git worktree add 'worktrees/name' -b 'feature/name'"
"git"-->>"shell": "Worktree created"
"shell"->>"shell": "mkdir -p 'worktrees/name/.claude'"
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
🚅 Environment byte-pr-126 in byte has no services deployed. |
Contributor
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- The empty-name validation currently treats a string of only spaces as valid; consider trimming whitespace from the input (both interactive and NAME-based) before the -z check to prevent creating branches like
feature/.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The empty-name validation currently treats a string of only spaces as valid; consider trimming whitespace from the input (both interactive and NAME-based) before the -z check to prevent creating branches like `feature/ `.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Documentation preview will be available shortly at https://jacobcoffee.github.io/byte-docs-preview/126 |
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
make worktreeto support non-interactive usage viaNAMEparameterProblem
Subagents were unable to use
make worktreebecause it relied on an interactivereadprompt. When the prompt received no input, it created an invalid branch namefeature/, causing git errors.Solution
Modified the
worktreetarget in the Makefile to:NAMEparameter:make worktree NAME=my-featureNAMEnot provided:make worktreeChanges
worktreetarget with parameter support and validationUsage Examples
Testing
make worktree NAME=test-makefile-fix🤖 Generated with Claude Code
Summary by Sourcery
Allow creating git worktrees non-interactively while preserving existing interactive workflow.
New Features:
Bug Fixes:
Enhancements: