Skip to content

Update the install script to install the PSReadLine dependency as needed #381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tools/scripts/install-aishell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ $Script:WinInstallationLocation = "$env:LOCALAPPDATA\Programs\AIShell"
$Script:InstallLocation = $null
$Script:PackageURL = $null
$Script:ModuleVersion = $null
$Script:NewPSRLInstalled = $false
$Script:PSRLDependencyMap = @{ '1.0.4-preview4' = '2.4.2-beta2' }

function Resolve-Environment {
if ($PSVersionTable.PSVersion -lt [version]"7.4.6") {
Expand Down Expand Up @@ -209,6 +211,18 @@ function Install-AIShellModule {
Write-Host "Installing the PowerShell module 'AIShell' $modVersion ..."
Install-PSResource -Name AIShell -Repository PSGallery -Prerelease -TrustRepository -Version $modVersion -ErrorAction Stop -WarningAction SilentlyContinue

$psrldep = $Script:PSRLDependencyMap[$modVersion]
if ($psrldep) {
$psrlModule = Get-Module -Name PSReadLine
$psrlVer = $psrldep.Contains('-') ? $psrldep.Split('-')[0] : $psrldep
if ($null -eq $psrlModule -or $psrlModule.Version -lt [version]$psrlVer) {
Write-Host " - This version of AIShell module depends on PSReadLine '$psrldep' or higher, which is missing."
Write-Host " Installing the PowerShell module 'PSReadLine' $psrldep or a higher version ..."
Install-PSResource -Name PSReadLine -Repository PSGallery -Prerelease -TrustRepository -Version "[$psrldep, ]" -ErrorAction Stop -WarningAction SilentlyContinue
$Script:NewPSRLInstalled = $true
}
}

if ($IsMacOS) {
Write-Host -ForegroundColor Yellow "NOTE: The 'AIShell' PowerShell module only works in iTerm2 terminal in order to provide the sidecar experience."
}
Expand Down Expand Up @@ -249,4 +263,10 @@ Installation succeeded.
To learn more about AI Shell please visit https://aka.ms/AIShell-Docs.
To get started, please run 'Start-AIShell' to use the sidecar experience${condition}, or run 'aish' to use the standalone experience.
"@
if ($Script:NewPSRLInstalled) {
Write-Host -ForegroundColor Yellow -Object @"
NOTE: A new version of the PSReadLine module was installed as a dependency.
To ensure the new PSReadLine gets used, please run 'Start-AIShell' from a new session.
"@
}
}