@@ -116,7 +116,7 @@ function Install-AITool {
116116 $existingInstallations = @ ()
117117 if (Test-Command - Command $tool.Command ) {
118118 # Get all installed versions
119- if ($tool. IsWrapper ) {
119+ if ($tool [ ' IsWrapper' ] ) {
120120 $modules = Get-Module - ListAvailable - Name $tool.Command | Sort-Object Version - Descending
121121 foreach ($module in $modules ) {
122122 $existingInstallations += [PSCustomObject ]@ {
@@ -126,11 +126,9 @@ function Install-AITool {
126126 }
127127 } else {
128128 # For CLI tools, we can only detect the currently active version
129- $installedVersion = & $tool.Command -- version 2>&1 | Select-Object - First 1
130- $commandPath = (Get-Command $tool.Command - ErrorAction SilentlyContinue).Source
131- if (-not $commandPath ) {
132- $commandPath = (Get-Command $tool.Command - ErrorAction SilentlyContinue).Path
133- }
129+ $installedVersion = Get-CommandVersion - Command $tool.Command
130+ $commandInfo = Get-Command $tool.Command - ErrorAction SilentlyContinue
131+ $commandPath = if ($commandInfo ) { $commandInfo.Source } else { $null }
134132 $existingInstallations += [PSCustomObject ]@ {
135133 Version = ($installedVersion -replace ' ^.*?(\d+\.\d+\.\d+).*$' , ' $1' ).Trim()
136134 Path = $commandPath
@@ -378,7 +376,7 @@ function Install-AITool {
378376 }
379377
380378 if ($useWingetFallback ) {
381- $wingetFallbackCmd = if ($tool. FallbackInstallCommands ) { $tool. FallbackInstallCommands [$os ] } else { $null }
379+ $wingetFallbackCmd = if ($tool [ ' FallbackInstallCommands' ] ) { $tool [ ' FallbackInstallCommands' ] [$os ] } else { $null }
382380 if ($wingetFallbackCmd ) {
383381 if ($wingetFallbackCmd -isnot [array ]) { $wingetFallbackCmd = @ ($wingetFallbackCmd ) }
384382 $installCmd = $wingetFallbackCmd
@@ -650,7 +648,7 @@ function Install-AITool {
650648
651649 # Check if this is a PowerShell cmdlet (for wrapper modules like PSOpenAI)
652650 # PowerShell cmdlets must be executed via Invoke-Expression, not Start-Process
653- $isPowerShellCmdlet = $tool. IsWrapper -or $cmd -match ' ^(Install-Module|Uninstall-Module|Update-Module|Import-Module)'
651+ $isPowerShellCmdlet = $tool [ ' IsWrapper' ] -or $cmd -match ' ^(Install-Module|Uninstall-Module|Update-Module|Import-Module)'
654652
655653 # Check if command contains shell operators (pipes, redirects, semicolons, etc.)
656654 # These require shell execution and can't be handled by Start-Process
@@ -700,6 +698,8 @@ function Install-AITool {
700698 Invoke-Expression $cmd
701699 $exitCode = $LASTEXITCODE
702700 if (-not $exitCode ) { $exitCode = 0 }
701+ $stdout = ' '
702+ $stderr = ' '
703703 } else {
704704 # Use cmd.exe for other shell operators
705705 Write-PSFMessage - Level Verbose - Message " Executing via cmd.exe"
@@ -802,9 +802,6 @@ function Install-AITool {
802802
803803 if ($selectedCommand ) {
804804 $resolvedExecutable = $selectedCommand.Source
805- if (-not $resolvedExecutable ) {
806- $resolvedExecutable = $selectedCommand.Path
807- }
808805 Write-PSFMessage - Level Verbose - Message " Resolved executable: $resolvedExecutable "
809806 } else {
810807 # Fallback to original executable name
@@ -969,9 +966,9 @@ function Install-AITool {
969966 }
970967
971968 # Generic fallback: try FallbackInstallCommands if primary install failed
972- $hasFallback = $tool. FallbackInstallCommands -and $tool. FallbackInstallCommands [$os ]
969+ $hasFallback = $tool [ ' FallbackInstallCommands' ] -and $tool [ ' FallbackInstallCommands' ] [$os ]
973970 if ($exitCode -ne 0 -and $hasFallback ) {
974- $fallbackCmds = $tool. FallbackInstallCommands [$os ]
971+ $fallbackCmds = $tool [ ' FallbackInstallCommands' ] [$os ]
975972 if ($fallbackCmds -isnot [array ]) { $fallbackCmds = @ ($fallbackCmds ) }
976973
977974 # Only try fallback if we're not already executing a fallback command
@@ -1215,17 +1212,15 @@ function Install-AITool {
12151212 Write-PSFMessage - Level Verbose - Message " $currentToolName installed successfully!"
12161213
12171214 # Get version differently for PowerShell modules vs CLIs
1218- if ($tool. IsWrapper ) {
1215+ if ($tool [ ' IsWrapper' ] ) {
12191216 $module = Get-Module - ListAvailable - Name $tool.Command | Sort-Object Version - Descending | Select-Object - First 1
12201217 $version = $module.Version.ToString ()
12211218 $commandPath = $module.Path
12221219 } else {
1223- $version = & $tool.Command -- version 2>&1 | Select-Object - First 1
1220+ $version = Get-CommandVersion - Command $tool.Command
12241221 # Get the full path to the command
1225- $commandPath = (Get-Command $tool.Command - ErrorAction SilentlyContinue).Source
1226- if (-not $commandPath ) {
1227- $commandPath = (Get-Command $tool.Command - ErrorAction SilentlyContinue).Path
1228- }
1222+ $commandInfo = Get-Command $tool.Command - ErrorAction SilentlyContinue
1223+ $commandPath = if ($commandInfo ) { $commandInfo.Source } else { $null }
12291224 }
12301225
12311226 Write-PSFMessage - Level Verbose - Message " Version: $version "
0 commit comments