@@ -19,6 +19,8 @@ $Script:WinInstallationLocation = "$env:LOCALAPPDATA\Programs\AIShell"
19
19
$Script :InstallLocation = $null
20
20
$Script :PackageURL = $null
21
21
$Script :ModuleVersion = $null
22
+ $Script :NewPSRLInstalled = $false
23
+ $Script :PSRLDependencyMap = @ { ' 1.0.4-preview4' = ' 2.4.2-beta2' }
22
24
23
25
function Resolve-Environment {
24
26
if ($PSVersionTable.PSVersion -lt [version ]" 7.4.6" ) {
@@ -209,6 +211,18 @@ function Install-AIShellModule {
209
211
Write-Host " Installing the PowerShell module 'AIShell' $modVersion ..."
210
212
Install-PSResource - Name AIShell - Repository PSGallery - Prerelease - TrustRepository - Version $modVersion - ErrorAction Stop - WarningAction SilentlyContinue
211
213
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
+
212
226
if ($IsMacOS ) {
213
227
Write-Host - ForegroundColor Yellow " NOTE: The 'AIShell' PowerShell module only works in iTerm2 terminal in order to provide the sidecar experience."
214
228
}
@@ -249,4 +263,10 @@ Installation succeeded.
249
263
To learn more about AI Shell please visit https://aka.ms/AIShell-Docs.
250
264
To get started, please run 'Start-AIShell' to use the sidecar experience${condition} , or run 'aish' to use the standalone experience.
251
265
"@
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
+ }
252
272
}
0 commit comments