PowerShell hotkey integration for Windows#1
Merged
Conversation
The default shell on Windows is PowerShell, but `aiss init` only emitted zsh/bash/fish snippets, so Windows users had no Ctrl-X Ctrl-W hotkey. - shell/aiss.ps1: PSReadLine key handler (Ctrl-X Ctrl-W), override via $env:AISS_KEYBIND_PWSH. Captures stdout, leaves stderr alone so the picker stays visible. - aiss init powershell (alias pwsh): emit the embedded snippet. - --print --pwsh + resumePlan.PowerShell(): emit Push-Location / try / Pop-Location, since PowerShell has no `( cd && )` subshell and doubles single quotes rather than using '\''. - tests for PowerShell() and pwshQuote(); README + goreleaser caveat. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The picker only acquired a terminal via /dev/tty, which doesn't exist on native Windows. It fell back to stderr for output but left input as the inherited os.Stdin — and when the pwsh handler runs us with stdout captured to a pipe, that stdin carries no key events, so the picker hung with no way to make a selection. Split terminal acquisition into a platform helper: /dev/tty on POSIX, CONIN$/CONOUT$ on Windows (the same console-device trick fzf uses). Both input and output now go to the real console. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Windows users had no
Ctrl-X Ctrl-Whotkey:aiss initonly emitted zsh/bash/fish snippets, and the default Windows shell is PowerShell. This adds a PowerShell integration and fixes a picker bug that made it hang on native Windows.Changes
PowerShell integration
shell/aiss.ps1— PSReadLine key handler bound toCtrl-X Ctrl-W(override with$env:AISS_KEYBIND_PWSH). Captures stdout and deliberately leaves stderr alone, since that's where the picker draws.aiss init powershell(aliaspwsh) emits the embedded snippet.--print --pwsh→ newresumePlan.PowerShell()emittingPush-Location … ; try { & … } finally { Pop-Location }. PowerShell has no( cd && )subshell and escapes'by doubling it, so the existing POSIXShell()output can't be reused.Picker fix (the reason the hotkey appeared dead)
/dev/tty, which doesn't exist on native Windows. It fell back to stderr for output but left input as the inheritedos.Stdin. When the pwsh handler runsaisswith stdout captured to a pipe, that stdin carries no key events → the picker hangs with no way to select./dev/ttyon POSIX (console_other.go),CONIN$/CONOUT$on Windows (console_windows.go) — the same console-device approach fzf uses.Testing
go build ./... && go vet ./... && go test ./...all pass.TestPlanResumePowerShellandTestPwshQuoteEscapesQuotes.Ctrl+x,Ctrl+w → aiss, and the emittedPush-Location … Pop-Locationcommand parses, executes, and restores the caller's directory even for a path containing a space and an embedded quote.CONIN$/CONOUT$on an attached console.POSIX behavior is unchanged — the Windows console code is behind a
//go:build windowstag.🤖 Generated with Claude Code