Skip to content

fix(pwsh): preserve hyphenated native options#60

Merged
Aaronontheweb merged 2 commits into
devfrom
fix/52-pwsh-hyphenated-options
Jul 22, 2026
Merged

fix(pwsh): preserve hyphenated native options#60
Aaronontheweb merged 2 commits into
devfrom
fix/52-pwsh-hyphenated-options

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Owner

Summary

  • preserve internal hyphens in PowerShell parameters and native options
  • apply Bash-compatible native --flag=value splitting and curated path classification
  • keep colon binding cmdlet-only and preserve native colon options verbatim
  • clarify the PowerShell specification and update the implementation plan
  • add focused unit coverage and five PowerShell corpus regressions

Security impact

This restores path detection for curated native flags such as git --work-tree repo. Previously, a bare path value could be misclassified as a literal and omitted from downstream zone-gate evaluation.

Unknown native flags retain their existing conservative semantics, and dynamic curated path values still safe-fail as DynamicSkip.

Validation

  • dotnet build -c Release: 0 warnings, 0 errors
  • dotnet test -c Release: 779 passed, 0 failed, 0 skipped
  • PowerShell corpus and real-pwsh oracle passed
  • PII audit and public API snapshot passed
  • file-header verification passed

Closes #52

Follow-ups from the #52 review:

- hoist the equals-form option split into a shared NativeFlagSyntax so
  the bash and PowerShell parsers cannot drift on a rule SPEC.POWERSHELL
  §7.3 requires to stay identical
- a colon value under an `=`-bearing parameter name now safe-fails to
  DynamicSkip. PowerShell reads `-Path=C:\Windows` as parameter
  `-Path=C:` plus argument `\Windows`, a name no cmdlet can bind, so the
  value's role is unknowable and we must not hand the gate a confident
  literal
- `-?` lexes as one parameter token. IsParameterStart already admitted
  `?`, but the name-continuation predicate did not, so `Get-Help -?`
  came out as a bare `-` flag plus a `?` glob
- correct the comment on the native non-equals branch, which handles
  every option shape rather than only the colon form

Verified against the real pwsh tokenizer; bash/pwsh output stays
identical across the native-option sweep.
@Aaronontheweb
Aaronontheweb merged commit a51dd76 into dev Jul 22, 2026
2 checks passed
@Aaronontheweb
Aaronontheweb deleted the fix/52-pwsh-hyphenated-options branch July 22, 2026 04:13
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.

PwshParser splits flags that contain a hyphen

1 participant