fix(scripts): add explicit positional binding to PowerShell create-new-feature params#1885
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>
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.
|
Thank you! |
There was a problem hiding this comment.
Pull request overview
Adjusts PowerShell parameter metadata in create-new-feature.ps1 so AI/CLI invocations that pass the feature description positionally no longer get mis-bound to the numeric -Number parameter (fixing the ParameterBindingArgumentTransformationException reported in #1879).
Changes:
- Makes
FeatureDescriptionexplicitly positional (Position = 0) and collect remaining arguments. - Adds an explicit
[Parameter()]attribute toNumber(leaving it without an explicitPosition).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for the quick review and merge! Happy to help wire up the hook lifecycle. |
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