From b78aa7e05758df6751b1931988c1a78602d9ce69 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 22 Apr 2025 11:23:26 -0700 Subject: [PATCH 1/3] Check if running in iTerm2 and throw if not --- shell/AIShell.Integration/AIShell.psm1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/AIShell.Integration/AIShell.psm1 b/shell/AIShell.Integration/AIShell.psm1 index aeb02f7e..c9dd2ed2 100644 --- a/shell/AIShell.Integration/AIShell.psm1 +++ b/shell/AIShell.Integration/AIShell.psm1 @@ -1,3 +1,7 @@ +if ($IsMacOS -and $env:TERM_PROGRAM -ne "iTerm.app") { + throw "The AIShell module requires iTerm2 to work properly. Please install and run from the iTerm2 terminal." +} + $module = Get-Module -Name PSReadLine if ($null -eq $module -or $module.Version -lt [version]"2.4.2") { throw "The PSReadLine v2.4.2-beta2 or higher is required for the AIShell module to work properly." From a67409a284c432b502f4735d559b64fa04560635 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 22 Apr 2025 12:23:56 -0700 Subject: [PATCH 2/3] Install AIShell module on macOS --- tools/scripts/install-aishell.ps1 | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/scripts/install-aishell.ps1 b/tools/scripts/install-aishell.ps1 index 09760d93..5c9b344d 100644 --- a/tools/scripts/install-aishell.ps1 +++ b/tools/scripts/install-aishell.ps1 @@ -204,13 +204,12 @@ function Uninstall-AIShellApp { } function Install-AIShellModule { - if ($IsWindows) { - $modVersion = $Script:ModuleVersion - Write-Host "Installing the PowerShell module 'AIShell' $modVersion ..." - Install-PSResource -Name AIShell -Repository PSGallery -Prerelease -TrustRepository -Version $modVersion -ErrorAction Stop -WarningAction SilentlyContinue - } else { - Write-Host -ForegroundColor Yellow "Currently the AIShell PowerShell module will only work in iTerm2 terminal and still has limited support but if you would like to test it, you can install it with 'Install-PSResource -Name AIShell -Repository PSGallery -Prerelease'." - Write-Host -ForegroundColor Yellow "The AI Shell app has been added to your path, please run 'aish' to use the standalone experience." + $modVersion = $Script:ModuleVersion + Write-Host "Installing the PowerShell module 'AIShell' $modVersion ..." + Install-PSResource -Name AIShell -Repository PSGallery -Prerelease -TrustRepository -Version $modVersion -ErrorAction Stop -WarningAction SilentlyContinue + + if ($IsMacOS) { + Write-Host -ForegroundColor Yellow "NOTE: The 'AIShell' PowerShell module only works in iTerm2 terminal in order to provide the sidecar experience." } } @@ -237,12 +236,16 @@ if ($Uninstall) { Uninstall-AIShellApp Uninstall-AIShellModule - $message = $IsWindows ? "AI Shell App and PowerShell module have" : "AI Shell App has" - Write-Host "`n$message been successfully uninstalled." -ForegroundColor Green + Write-Host -ForegroundColor Green "`nAI Shell App and PowerShell module have been successfully uninstalled." } else { Install-AIShellApp Install-AIShellModule - $message = $IsWindows ? "'Start-AIShell'" : "'aish'" - Write-Host "`nInstallation succeeded.`nTo learn more about AI Shell please visit https://aka.ms/AIShell-Docs.`nTo get started please run $message to start AI Shell." -ForegroundColor Green + $condition = $IsMacOS ? " if you are in iTerm2" : $null + Write-Host -ForegroundColor Green -Object @" + +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. +"@ } From 92bafbdb1d1627f4711d92ccbe966cfe66bede53 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 22 Apr 2025 13:12:24 -0700 Subject: [PATCH 3/3] Add one message --- tools/scripts/install-aishell.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/scripts/install-aishell.ps1 b/tools/scripts/install-aishell.ps1 index 5c9b344d..3d1317fc 100644 --- a/tools/scripts/install-aishell.ps1 +++ b/tools/scripts/install-aishell.ps1 @@ -95,6 +95,7 @@ function Install-AIShellApp { if (-not $destinationExists) { # Create the directory if not existing. + Write-Host "Creating the target folder '$destination' ..." if ($IsWindows) { $null = New-Item -Path $destination -ItemType Directory -Force } else {