Add PowerShell (pwsh) shell integration - #94
Merged
Merged
Conversation
Adds key binding integration for PowerShell via a new shelloracle.ps1 script that uses PSReadLine to bind Ctrl+F. The bootstrap installer now detects pwsh as a supported shell, writes the script to ~/.shelloracle.ps1, and sources it from the PowerShell profile (platform-aware path for Windows vs macOS/Linux). The SHOR_SHELL environment variable is read by get_system_prompt() so the LLM is instructed to produce PowerShell syntax when invoked from a PowerShell session, rather than defaulting to Bash. Fixes djcopley#80 Signed-off-by: Christian-Sidak <61099993+Christian-Sidak@users.noreply.github.com>
Closed
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
shelloracle.ps1key binding script for PowerShell using PSReadLine (Ctrl+F)pwsh, write the script to~/.shelloracle.ps1, and source it from the PowerShell profile (Windows:~/Documents/PowerShell/, macOS/Linux:~/.config/powershell/)get_system_prompt()inproviders/__init__.pythat readsSHOR_SHELLfrom the environment so the LLM generates PowerShell syntax when invoked from a PowerShell sessiontests/test_bootstrap.pycovering the new path helpers and system prompt logicHow it works
The PS1 script sets
SHOR_SHELL=powershellbefore callingshor, so each fresh process picks it up at module import time and instructs the LLM accordingly. The current line buffer is also forwarded viaSHOR_DEFAULT_PROMPT(matching the zsh/bash/fish behavior).Test plan
uv run --group test pytest -v)get_bundled_script_path("pwsh")returns a path to the bundled.ps1file that actually exists on diskget_rc_path("pwsh")returns the Windows profile path on Windows, and the XDG path elsewhereget_system_prompt()returns a Bash prompt by default and a PowerShell prompt whenSHOR_SHELL=powershellFixes #80