From 5b5b20cc3caf98d73093d5f815e59ed75ebf08ba Mon Sep 17 00:00:00 2001 From: RudySource <80245370+RudySource@users.noreply.github.com> Date: Wed, 9 Sep 2026 00:13:20 +0300 Subject: [PATCH 1/2] fix: support current PowerShell predictors --- .github/workflows/ci.yml | 29 +++++++++++++++++++ CHANGELOG.md | 7 +++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 7 +++-- docs/architecture/suggestions.md | 2 +- packaging/scoop/dirgo.json.template | 2 +- powershell/DirgoPredictor/DirgoPredictor.psd1 | 2 +- scripts/windows-suggestions-smoke.ps1 | 13 +++++++-- src/shell.rs | 10 ++++++- 10 files changed, 65 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbeef6a..b8f8791 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,35 @@ jobs: if: runner.os == 'Windows' shell: pwsh run: ./scripts/windows-suggestions-smoke.ps1 -DgoBin (Resolve-Path target/release/dgo.exe) + - name: PowerShell native predictor version matrix + if: runner.os == 'Windows' + shell: pwsh + run: | + $releases = @( + @{ Version = '7.4.19'; Sha256 = 'CD62AD6D8174CC6FB85B335A0058444BC934FE27C39FA97FE342134286D28AF9' }, + @{ Version = '7.5.10'; Sha256 = '680D8CA69C5514D0BD4496AC6E94391155B4C71E97223BBDE28A0E5230C20979' }, + @{ Version = '7.6.4'; Sha256 = '80832551C52809301E6071C8BAC977BEB5A2F1EC953EB4DB9F94DEB953333793' } + ) + foreach ($release in $releases) { + $archive = Join-Path $env:RUNNER_TEMP "PowerShell-$($release.Version)-win-x64.zip" + $destination = Join-Path $env:RUNNER_TEMP "PowerShell-$($release.Version)" + $uri = "https://github.com/PowerShell/PowerShell/releases/download/v$($release.Version)/PowerShell-$($release.Version)-win-x64.zip" + Invoke-WebRequest -Uri $uri -OutFile $archive + $actualHash = (Get-FileHash -Algorithm SHA256 $archive).Hash + if ($actualHash -ne $release.Sha256) { + throw "PowerShell $($release.Version) archive checksum mismatch" + } + Expand-Archive -LiteralPath $archive -DestinationPath $destination + $pwsh = Join-Path $destination 'pwsh.exe' + $actualVersion = & $pwsh -NoLogo -NoProfile -Command '$PSVersionTable.PSVersion.ToString()' + if ($actualVersion -ne $release.Version) { + throw "Expected PowerShell $($release.Version), found $actualVersion" + } + & $pwsh -NoLogo -NoProfile -File ./scripts/windows-suggestions-smoke.ps1 -DgoBin (Resolve-Path target/release/dgo.exe) -RequireNativePredictor + if ($LASTEXITCODE -ne 0) { + throw "PowerShell $($release.Version) suggestions smoke failed" + } + } - name: Verify Linux glibc compatibility baseline if: runner.os == 'Linux' run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 26703aa..4967ab1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes follow Keep a Changelog and Semantic Versioning. ## [Unreleased] +## [0.8.4] - 2026-09-09 + +### Fixed + +- Enable the native Dirgo predictor on supported PowerShell releases newer than 7.4, including PowerShell 7.5 and 7.6, instead of rejecting every minor version other than 7.4. +- Exercise the native prediction path on any PowerShell 7.4+ Windows runner so future LTS upgrades cannot silently disable suggestions. + ## [0.8.3] - 2026-09-08 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index afb7c92..18b1cde 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -412,7 +412,7 @@ checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" [[package]] name = "dirgo" -version = "0.8.3" +version = "0.8.4" dependencies = [ "anyhow", "assert_cmd", diff --git a/Cargo.toml b/Cargo.toml index 6e54cd4..4029c59 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dirgo" -version = "0.8.3" +version = "0.8.4" default-run = "dgo" edition = "2024" rust-version = "1.89" diff --git a/README.md b/README.md index 8ad53c8..96b2df4 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,7 @@ match the installed binary.

- **Zsh:** responsive paged panel with descriptions and `Tab` insertion. -- **PowerShell 7.4.x:** native PSReadLine ListView prediction. +- **PowerShell 7.4+:** native PSReadLine ListView prediction. - **Fish and Bash 4+:** enriched native `Tab` completion. - **Every supported shell:** `Ctrl+F` inserts the best result and `Shift+Tab` opens the explicit source-labelled picker. @@ -526,7 +526,7 @@ each keystroke. | macOS Apple Silicon | Homebrew, installer, archive | Zsh, Bash, Fish | | macOS Intel | Installer, archive | Zsh, Bash, Fish | | Linux x86_64 GNU | Installer, archive; glibc 2.35+ | Zsh, Bash, Fish | -| Windows x86_64 MSVC | PowerShell installer, Scoop, archive | PowerShell 7+; native predictor on 7.4.x | +| Windows x86_64 MSVC | PowerShell installer, Scoop, archive | PowerShell 7+; native predictor on 7.4+ | WSL uses its Zsh, Bash, or Fish adapter. @@ -567,7 +567,8 @@ Report vulnerabilities privately through [SECURITY.md](SECURITY.md). | Version | Status | User-visible scope | | --- | --- | --- | -| **0.8.3** | Current stable release | Self-contained Windows installation, fresh interactive update checks, local Workflow Intelligence, and Workspace Palette. | +| **0.8.4** | Current stable release | Native suggestions on current PowerShell 7 releases, including 7.5 and 7.6. | +| **0.8.3** | Previous stable release | Self-contained Windows installation, fresh interactive update checks, local Workflow Intelligence, and Workspace Palette. | | **0.8.2** | Previous stable release | Windows user-level installation, fresh interactive update checks, local Workflow Intelligence, and Workspace Palette. | | **0.7.1** | Previous stable release | Workspace Palette, focused roots, ordered path search, bounded lazy previews, safe source switching, cached update awareness, and easier Windows installation. | | **0.6.0** | Previous stable release | Opt-in completed-command context, schema v2 migration, project/success-aware ranking, scoped inspection, clearing, and privacy-preserving export. | diff --git a/docs/architecture/suggestions.md b/docs/architecture/suggestions.md index d2f196e..57fd6d5 100644 --- a/docs/architecture/suggestions.md +++ b/docs/architecture/suggestions.md @@ -200,7 +200,7 @@ pruned to 64 projects. | Zsh | Full automatic live panel through `zle-line-pre-redraw`, anchored after the editable buffer with `POSTDISPLAY`; existing widgets and keymaps are preserved | | Fish | Built-in live autosuggestion plus its native completion pager; Dirgo enriches candidates without replacing Fish's editor | | Bash 4+ | Context-complete explicit list and insertion through Readline; no per-character key rebinding | -| PowerShell 7+ | `Ctrl+F` insertion; PowerShell 7.4.x gets automatic native PSReadLine `ListView` prediction | +| PowerShell 7+ | `Ctrl+F` insertion; PowerShell 7.4+ gets automatic native PSReadLine `ListView` prediction | WSL uses the corresponding Linux shell adapter. Windows PowerShell 5.1 and `cmd.exe` are not supported. diff --git a/packaging/scoop/dirgo.json.template b/packaging/scoop/dirgo.json.template index d977730..fa32d69 100644 --- a/packaging/scoop/dirgo.json.template +++ b/packaging/scoop/dirgo.json.template @@ -5,7 +5,7 @@ "license": "MIT", "notes": [ "Run 'dgo setup' from PowerShell 7+ to enable parent-shell navigation and safe suggestions.", - "Native inline and list prediction is available on PowerShell 7.4.x with PSReadLine 2.2.2+." + "Native inline and list prediction is available on PowerShell 7.4+ with PSReadLine 2.2.2+." ], "architecture": { "64bit": { diff --git a/powershell/DirgoPredictor/DirgoPredictor.psd1 b/powershell/DirgoPredictor/DirgoPredictor.psd1 index e558cb1..2fd572d 100644 --- a/powershell/DirgoPredictor/DirgoPredictor.psd1 +++ b/powershell/DirgoPredictor/DirgoPredictor.psd1 @@ -1,6 +1,6 @@ @{ RootModule = 'DirgoPredictor.dll' - ModuleVersion = '0.8.3' + ModuleVersion = '0.8.4' GUID = '531a90d6-192f-46c7-94cb-2c81413eed9b' Author = 'Dirgo contributors' CompanyName = 'Dirgo' diff --git a/scripts/windows-suggestions-smoke.ps1 b/scripts/windows-suggestions-smoke.ps1 index f34dd85..70f0385 100644 --- a/scripts/windows-suggestions-smoke.ps1 +++ b/scripts/windows-suggestions-smoke.ps1 @@ -1,6 +1,7 @@ param( [Parameter(Mandatory = $true)] - [string]$DgoBin + [string]$DgoBin, + [switch]$RequireNativePredictor ) $ErrorActionPreference = 'Stop' @@ -41,10 +42,15 @@ try { $handler = Get-PSReadLineKeyHandler -Chord Ctrl+f if ($handler.Function -ne 'DirgoSuggestion') { throw 'Ctrl+f suggestion handler is missing' } } + $psReadLineVersion = (Get-Module -ListAvailable PSReadLine | Sort-Object Version -Descending | Select-Object -First 1).Version + if ($RequireNativePredictor -and $psReadLineVersion -lt [version]'2.2.2') { + throw "native predictor smoke requires PSReadLine 2.2.2+, found $psReadLineVersion" + } + $dirgoPredictorRegistered = $false $version = (& $DgoBin --version) -replace '^dgo\s+', '' $manifest = Join-Path (Split-Path -Parent $DgoBin) "DirgoPredictor/$version/DirgoPredictor.psd1" if ($PSVersionTable.PSVersion.Major -eq 7 -and - $PSVersionTable.PSVersion.Minor -eq 4 -and + $PSVersionTable.PSVersion -ge [version]'7.4.0' -and (Test-Path -LiteralPath $manifest)) { $predictors = [System.Management.Automation.Subsystem.SubsystemManager]::GetSubsystemInfo( [System.Management.Automation.Subsystem.SubsystemKind]::CommandPredictor).Implementations @@ -73,6 +79,9 @@ try { return $result } } + if ($RequireNativePredictor -and -not $dirgoPredictorRegistered) { + throw "Dirgo predictor was not registered on PowerShell $($PSVersionTable.PSVersion)" + } Set-Location -LiteralPath $root $replacement = Invoke-DirgoSuggestion -BeforeCursor 'Set-Location pun' -AfterCursor '' diff --git a/src/shell.rs b/src/shell.rs index 436e9d2..62ec18b 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -1316,7 +1316,7 @@ if ($suggestionsEnabled -and (Get-Module -ListAvailable PSReadLine)) { $nativeCompletionsEnabled = $LASTEXITCODE -eq 0 if ($nativeCompletionsEnabled -and $PSVersionTable.PSVersion.Major -eq 7 -and - $PSVersionTable.PSVersion.Minor -eq 4 -and + $PSVersionTable.PSVersion -ge [version]'7.4.0' -and $psReadLineVersion -ge [version]'2.2.2' -and (Test-Path -LiteralPath $predictorManifest)) { Import-Module $predictorManifest -ErrorAction SilentlyContinue @@ -1574,6 +1574,14 @@ mod tests { assert!(!script.contains("AcceptLine")); } + #[test] + fn powershell_predictor_accepts_supported_7x_versions_after_7_4() { + let script = integration(Shell::PowerShell); + assert!(script.contains("$PSVersionTable.PSVersion.Major -eq 7")); + assert!(script.contains("$PSVersionTable.PSVersion -ge [version]'7.4.0'")); + assert!(!script.contains("$PSVersionTable.PSVersion.Minor -eq 4")); + } + #[test] fn history_adapters_capture_completed_command_context_without_debug_traps() { let zsh = integration(Shell::Zsh); From de768fb452dd18c6b6bc5ae5f83484323ce4eef8 Mon Sep 17 00:00:00 2001 From: RudySource <80245370+RudySource@users.noreply.github.com> Date: Wed, 9 Sep 2026 13:26:47 +0300 Subject: [PATCH 2/2] fix: handle redirected prediction output --- CHANGELOG.md | 1 + src/shell.rs | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4967ab1..bfa0025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes follow Keep a Changelog and Semantic Versioning. - Enable the native Dirgo predictor on supported PowerShell releases newer than 7.4, including PowerShell 7.5 and 7.6, instead of rejecting every minor version other than 7.4. - Exercise the native prediction path on any PowerShell 7.4+ Windows runner so future LTS upgrades cannot silently disable suggestions. +- Keep PowerShell profile startup quiet when PSReadLine refuses prediction UI settings for redirected or non-interactive output; the registered predictor and `Ctrl+F` fallback remain available. ## [0.8.3] - 2026-09-08 diff --git a/src/shell.rs b/src/shell.rs index 62ec18b..634e6ca 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -1325,8 +1325,13 @@ if ($suggestionsEnabled -and (Get-Module -ListAvailable PSReadLine)) { if ($predictorSubsystem.Implementations.Name -contains 'Dirgo' -and $Host.UI.SupportsVirtualTerminal) { $dirgoPredictorRegistered = $true - Set-PSReadLineOption -PredictionSource HistoryAndPlugin - Set-PSReadLineOption -PredictionViewStyle ListView + try { + Set-PSReadLineOption -PredictionSource HistoryAndPlugin -ErrorAction Stop + Set-PSReadLineOption -PredictionViewStyle ListView -ErrorAction Stop + } catch { + # PSReadLine can reject prediction UI settings when output is redirected. + # The predictor remains registered and Ctrl+F remains available. + } } } @@ -1580,6 +1585,18 @@ mod tests { assert!(script.contains("$PSVersionTable.PSVersion.Major -eq 7")); assert!(script.contains("$PSVersionTable.PSVersion -ge [version]'7.4.0'")); assert!(!script.contains("$PSVersionTable.PSVersion.Minor -eq 4")); + assert!( + script.contains( + "Set-PSReadLineOption -PredictionSource HistoryAndPlugin -ErrorAction Stop" + ) + ); + assert!( + script.contains("Set-PSReadLineOption -PredictionViewStyle ListView -ErrorAction Stop") + ); + assert!( + script + .contains("PSReadLine can reject prediction UI settings when output is redirected") + ); } #[test]