@@ -19,6 +19,8 @@ $Script:WinInstallationLocation = "$env:LOCALAPPDATA\Programs\AIShell"
1919$Script :InstallLocation = $null
2020$Script :PackageURL = $null
2121$Script :ModuleVersion = $null
22+ $Script :NewPSRLInstalled = $false
23+ $Script :PSRLDependencyMap = @ { ' 1.0.4-preview4' = ' 2.4.2-beta2' }
2224
2325function Resolve-Environment {
2426 if ($PSVersionTable.PSVersion -lt [version ]" 7.4.6" ) {
@@ -209,6 +211,18 @@ function Install-AIShellModule {
209211 Write-Host " Installing the PowerShell module 'AIShell' $modVersion ..."
210212 Install-PSResource - Name AIShell - Repository PSGallery - Prerelease - TrustRepository - Version $modVersion - ErrorAction Stop - WarningAction SilentlyContinue
211213
214+ $psrldep = $Script :PSRLDependencyMap [$modVersion ]
215+ if ($psrldep ) {
216+ $psrlModule = Get-Module - Name PSReadLine
217+ $psrlVer = $psrldep.Contains (' -' ) ? $psrldep.Split (' -' )[0 ] : $psrldep
218+ if ($null -eq $psrlModule -or $psrlModule.Version -lt [version ]$psrlVer ) {
219+ Write-Host " - This version of AIShell module depends on PSReadLine '$psrldep ' or higher, which is missing."
220+ Write-Host " Installing the PowerShell module 'PSReadLine' $psrldep or a higher version ..."
221+ Install-PSResource - Name PSReadLine - Repository PSGallery - Prerelease - TrustRepository - Version " [$psrldep , ]" - ErrorAction Stop - WarningAction SilentlyContinue
222+ $Script :NewPSRLInstalled = $true
223+ }
224+ }
225+
212226 if ($IsMacOS ) {
213227 Write-Host - ForegroundColor Yellow " NOTE: The 'AIShell' PowerShell module only works in iTerm2 terminal in order to provide the sidecar experience."
214228 }
@@ -249,4 +263,10 @@ Installation succeeded.
249263To learn more about AI Shell please visit https://aka.ms/AIShell-Docs.
250264To get started, please run 'Start-AIShell' to use the sidecar experience${condition} , or run 'aish' to use the standalone experience.
251265"@
266+ if ($Script :NewPSRLInstalled ) {
267+ Write-Host - ForegroundColor Yellow - Object @"
268+ NOTE: A new version of the PSReadLine module was installed as a dependency.
269+ To ensure the new PSReadLine gets used, please run 'Start-AIShell' from a new session.
270+ "@
271+ }
252272}
0 commit comments