Skip to content

Update installation script to install AIShell module on macOS too #374

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 3 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions shell/AIShell.Integration/AIShell.psm1
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
26 changes: 15 additions & 11 deletions tools/scripts/install-aishell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -204,13 +205,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."
}
}

Expand All @@ -237,12 +237,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.
"@
}