docs(cli): add Windows PowerShell completion example#1070
Conversation
The shell completion documentation only showed Unix/bash examples, making it unusable for Windows users. Added platform-specific examples for both Unix/macOS (bash) and Windows (PowerShell). Changes: - Add Unix/macOS (bash) example with ~/.bash_completion.d path - Add Windows (PowerShell) example with C:\Users\y00031947\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 path - Improve clarity with platform labels Fixes: Windows users cannot use shell completion manual installation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughReformats the CLI docs: adds a "Generate script for manual installation" heading and splits ChangesCLI Documentation Reorganization
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/cli.md`:
- Around line 1046-1047: The docs currently show a PowerShell snippet that uses
the overwrite redirect operator (`>`). Update the Windows (PowerShell) example
so it appends rather than overwrites: replace the line "openspec completion
generate powershell > $PROFILE" with a safe append variant — either "openspec
completion generate powershell >> $PROFILE" or the explicit PowerShell-safe form
"openspec completion generate powershell | Out-File -Append $PROFILE" and
optionally note how to edit the profile (e.g., notepad $PROFILE) so users can
inspect before modifying.
- Around line 1043-1044: The example uses a non-standard path
(~/.bash_completion.d/openspec) that isn't auto-sourced by bash on most systems;
update the docs for the "openspec completion generate bash" example to either
direct users to append to the common single-file location (~/.bash_completion)
or add a short note and the sourcing snippet that instructs users to source
~/.bash_completion.d/* from their ~/.bashrc/~/.bash_profile so the generated
file is actually loaded.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| # Unix/macOS (bash) | ||
| openspec completion generate bash > ~/.bash_completion.d/openspec |
There was a problem hiding this comment.
Verify the bash completion path works without additional setup.
The path ~/.bash_completion.d/openspec may not work automatically on most systems. The ~/.bash_completion.d/ directory is not typically auto-sourced by bash unless explicitly configured in ~/.bashrc or ~/.bash_profile.
Consider using ~/.bash_completion instead, or document that users must source the directory:
# Add to ~/.bashrc if using ~/.bash_completion.d/
for file in ~/.bash_completion.d/*; do
[ -r "$file" ] && source "$file"
doneAlternatively, update the example to append to the standard single-file location:
# Unix/macOS (bash)
openspec completion generate bash >> ~/.bash_completion🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/cli.md` around lines 1043 - 1044, The example uses a non-standard path
(~/.bash_completion.d/openspec) that isn't auto-sourced by bash on most systems;
update the docs for the "openspec completion generate bash" example to either
direct users to append to the common single-file location (~/.bash_completion)
or add a short note and the sourcing snippet that instructs users to source
~/.bash_completion.d/* from their ~/.bashrc/~/.bash_profile so the generated
file is actually loaded.
Critical fix: Using '>' operator would overwrite the user's PowerShell profile, deleting existing configurations. Changed to '>>' to append instead of overwrite, preserving user's existing settings.
Problem
The shell completion documentation only showed Unix/bash examples, making it unusable for Windows users.
Solution
Added platform-specific examples for both Unix/macOS (bash) and Windows (PowerShell).
Changes
~/.bash_completion.dpath$PROFILEpathTesting
Summary by CodeRabbit