Skip to content

Add PowerShell (pwsh) shell integration - #94

Merged
djcopley merged 2 commits into
djcopley:mainfrom
Christian-Sidak:fix/issue-80
Sep 13, 2026
Merged

djcopley merged 2 commits into
djcopley:mainfrom
Christian-Sidak:fix/issue-80

Conversation

@Christian-Sidak

Copy link
Copy Markdown
Contributor

Summary

  • Adds shelloracle.ps1 key binding script for PowerShell using PSReadLine (Ctrl+F)
  • Updates the bootstrap installer to detect pwsh, write the script to ~/.shelloracle.ps1, and source it from the PowerShell profile (Windows: ~/Documents/PowerShell/, macOS/Linux: ~/.config/powershell/)
  • Introduces get_system_prompt() in providers/__init__.py that reads SHOR_SHELL from the environment so the LLM generates PowerShell syntax when invoked from a PowerShell session
  • Adds tests/test_bootstrap.py covering the new path helpers and system prompt logic

How it works

The PS1 script sets SHOR_SHELL=powershell before calling shor, so each fresh process picks it up at module import time and instructs the LLM accordingly. The current line buffer is also forwarded via SHOR_DEFAULT_PROMPT (matching the zsh/bash/fish behavior).

Test plan

  • All 54 existing + new tests pass (uv run --group test pytest -v)
  • get_bundled_script_path("pwsh") returns a path to the bundled .ps1 file that actually exists on disk
  • get_rc_path("pwsh") returns the Windows profile path on Windows, and the XDG path elsewhere
  • get_system_prompt() returns a Bash prompt by default and a PowerShell prompt when SHOR_SHELL=powershell

Fixes #80

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>

@djcopley djcopley left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@djcopley
djcopley merged commit 48dd880 into djcopley:main Sep 13, 2026
7 checks passed
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.

Powershell support

2 participants