fix(scripts): add explicit positional binding to PowerShell create-new-feature params#1885
Open
mvanhorn wants to merge 1 commit intogithub:mainfrom
Open
fix(scripts): add explicit positional binding to PowerShell create-new-feature params#1885mvanhorn wants to merge 1 commit intogithub:mainfrom
mvanhorn wants to merge 1 commit intogithub:mainfrom
Conversation
…w-feature params The $Number (Int32) parameter was implicitly receiving positional arguments intended for $FeatureDescription, causing a ParameterBindingArgumentTransformationException when AI agents called the script with positional strings. Add [Parameter(Position = 0)] to $FeatureDescription so it binds first, and mark $Number with [Parameter()] (no Position) so it only binds by name (-Number N). Fixes github#1879 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes PowerShell positional argument binding in create-new-feature.ps1 so a feature description passed positionally (common with AI-agent invocations) binds to the description parameter instead of being incorrectly coerced into the numeric -Number parameter.
Changes:
- Assigns
Position = 0to$FeatureDescriptionand keepsValueFromRemainingArguments = $trueso the first positional argument is treated as the description. - Adds an explicit
[Parameter()]attribute to$Number(leaving it intended for named usage like-Number 3).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Fixes PowerShell positional parameter binding in
create-new-feature.ps1that causedParameterBindingArgumentTransformationExceptionwhen AI agents passed the feature description as a positional argument.Why this matters
When an AI agent calls
create-new-feature.ps1 'Add user authentication'with positional arguments, PowerShell's implicit binding assigns the string to$Number(Int32) before reaching$FeatureDescription, causing the script to fail on first attempt (#1879). The bash equivalent (create-new-feature.sh) already handles this correctly via explicit--numberflag parsing.Changes
[Parameter(Position = 0, ValueFromRemainingArguments = $true)]to$FeatureDescriptionso it binds first positionally[Parameter()](no Position) to$Numberso it only binds by name (-Number N)This matches the invocation pattern documented in
specify.mdline 45:-Json -ShortName "user-auth" "Add user authentication"Testing
uv run pytest)ruff check src/passesAI Disclosure
This PR was authored with AI assistance (Claude Code). The fix was identified from the error description in #1879 and verified against PowerShell parameter binding documentation.
Fixes #1879