#10723: fix(cli): filter empty flags in PowerShell completion generation
cli
stale
Cluster:
Zsh and PowerShell Completion Fixes
## Summary
- Same issue as the bash completion fix — `option.flags.split(" ")[0]` can produce empty strings when flags have leading spaces or unusual formatting
- This adds `.filter(Boolean)` to the PowerShell completion generator to skip empty flag entries, matching the fix already applied to the bash generator
## Test plan
- [x] Verified the generated PowerShell script produces valid completion arrays without empty entries
- [x] Existing tests pass
Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
- Updates PowerShell completion generation to avoid emitting empty flag entries when parsing `commander` option flags.
- The root-level `$completions` array now maps option flags, filters out falsy values, then quotes them for PowerShell.
- This aligns PowerShell completion behavior with the existing bash completion fix for similarly formatted `Option.flags` strings.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Change is narrowly scoped to PowerShell completion generation and only filters out empty flag strings before emitting the completion array; no broader logic, parsing, or I/O behavior changes.
- src/cli/completion-cli.ts
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#11165: fix(cli): filter empty flags in zsh and PowerShell nested completion
by Yida-Dev · 2026-02-07
93.4%
#10710: fix(cli): filter empty flags in bash completion generation
by Yida-Dev · 2026-02-06
91.5%
#13840: perf(cli): skip plugin loading during completion generation
by lailoo · 2026-02-11
75.1%
#12308: fix(cli): redirect log output to stderr during completion script ge...
by mcaxtr · 2026-02-09
74.9%
#17680: perf(cli): skip plugin loading during completion generation
by mcrolly · 2026-02-16
74.6%
#17437: fix(completion): avoid rc=1 for optionless zsh leaf commands
by ephelia-ai · 2026-02-15
74.5%
#9148: Fix: Speed up shell completion generation from ~4.6s to <200ms
by vishaltandale00 · 2026-02-04
74.1%
#22488: fix(cli): redirect plugin logs to stderr during completion
by pierreeurope · 2026-02-21
73.8%
#6382: fix(cli): silence Powerlevel10k Zsh warning from completion script
by dungngo4520 · 2026-02-01
71.4%
#9158: perf(completion): add fast path for cached completions
by gavinbmoore · 2026-02-04
71.2%