Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
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
2 changes: 1 addition & 1 deletion cmd/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ Examples:
if len(orgs) > 1 {
for _, orgId := range orgs {
fmt.Println()
fmt.Println(tui.Bold(orgNames[orgId]) + " " + tui.Muted("(" + orgId + ")"))
fmt.Println(tui.Bold(orgNames[orgId]) + " " + tui.Muted("("+orgId+")"))
fmt.Println()

headers := []string{tui.Title("Project Id"), tui.Title("Name"), tui.Title("Description")}
Expand Down
25 changes: 25 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,31 @@ function Add-ToPath {
# Also update current session
$env:PATH = "$env:PATH;$PathToAdd"
}

# Refresh PowerShell's command discovery to make the command immediately available
# This creates a temporary function with the same name as the executable to force PowerShell to refresh
$exeName = "agentuity"
$tempFunctionName = "global:$exeName"

# Remove any existing function with this name first
if (Get-Command $exeName -ErrorAction SilentlyContinue) {
if ((Get-Command $exeName).CommandType -eq "Function") {
Remove-Item -Path "Function:\$exeName" -ErrorAction SilentlyContinue
}
}

# Create a temporary function that will redirect to the actual executable
$scriptBlock = {
param($argumentList)
& "$PathToAdd\$exeName.exe" @argumentList
# Remove this function after first use to ensure future calls use the actual executable
Remove-Item -Path "Function:\$exeName" -ErrorAction SilentlyContinue
}

# Register the function
Set-Item -Path $tempFunctionName -Value $scriptBlock -Force

Write-Success "Command '$exeName' is now available in the current PowerShell session"
}
catch {
Write-Error "Failed to update PATH: $_"
Expand Down
6 changes: 3 additions & 3 deletions internal/mcp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ type MCPClientApplicationConfig struct {
Windows []string
Linux []string
}

func toPathArray(path string) []string {
if path == "" {
return []string{}
}
return []string{path}
}


type MCPClientConfig struct {
Name string
ConfigLocation string
Expand Down Expand Up @@ -130,7 +130,7 @@ func Detect(all bool) ([]MCPClientConfig, error) {
case "linux":
filepaths = config.Application.Linux
}

for _, filepath := range filepaths {
if filepath == "$PATH" {
if config.Command != "" {
Expand Down Expand Up @@ -236,7 +236,7 @@ func Install(ctx context.Context, logger logger.Logger) error {
if installed == 0 {
tui.ShowSuccess("All MCP clients are up-to-date")
}

return nil
}

Expand Down
58 changes: 52 additions & 6 deletions internal/util/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,46 @@ func upgradeWithWindowsMsi(ctx context.Context, version string) error {
}
defer os.RemoveAll(tempDir)

var uninstallErr error
uninstallAction := func() {
uninstallScriptPath := filepath.Join(tempDir, "uninstall.ps1")
uninstallScript := `
$products = Get-CimInstance -Class Win32_Product | Where-Object { $_.Name -like "*Agentuity*" }
if ($products) {
foreach ($product in $products) {
Write-Output "Uninstalling: $($product.Name) ($($product.IdentifyingNumber))"
$result = $product | Invoke-CimMethod -MethodName Uninstall
if ($result.ReturnValue -eq 0) {
Write-Output "Successfully uninstalled $($product.Name)"
} else {
Write-Output "Failed to uninstall $($product.Name) with return code $($result.ReturnValue)"
exit 1
}
}
exit 0
} else {
Write-Output "No existing Agentuity installation found"
exit 0
}
`
if err := os.WriteFile(uninstallScriptPath, []byte(uninstallScript), 0644); err != nil {
uninstallErr = fmt.Errorf("failed to create uninstall script: %w", err)
return
}

uninstallCmd := exec.CommandContext(ctx, "powershell", "-ExecutionPolicy", "Bypass", "-File", uninstallScriptPath)
output, err := uninstallCmd.CombinedOutput()
if err != nil {
uninstallErr = fmt.Errorf("failed to run uninstall script: %w, output: %s", err, string(output))
return
}
tui.ShowSuccess("Uninstall step completed: %s", strings.TrimSpace(string(output)))
}
tui.ShowSpinner("Checking for existing installations...", uninstallAction)
if uninstallErr != nil {
tui.ShowWarning("Uninstall failed, continuing with installation: %v", uninstallErr)
}

installerName := getMsiInstallerName()
installerURL := fmt.Sprintf("https://github.com/agentuity/cli/releases/download/%s/%s", version, installerName)
installerPath := filepath.Join(tempDir, installerName)
Expand All @@ -523,12 +563,18 @@ func upgradeWithWindowsMsi(ctx context.Context, version string) error {

var installErr error
installAction := func() {
updateCmd := exec.CommandContext(ctx, "msiexec", "/update", installerPath, "/qn")
if err := updateCmd.Run(); err != nil {
tui.ShowWarning("Update approach failed, trying install with reinstall: %v", err)
installCmd := exec.CommandContext(ctx, "msiexec", "/i", installerPath, "/qn", "REINSTALLMODE=amus", "REINSTALL=ALL")
if err := installCmd.Run(); err != nil {
installErr = fmt.Errorf("failed to run MSI installer: %w", err)
installCmd := exec.CommandContext(ctx, "msiexec", "/i", installerPath, "/qn", "/norestart")
if err := installCmd.Run(); err != nil {
tui.ShowWarning("Direct install failed, trying with update approach: %v", err)

updateCmd := exec.CommandContext(ctx, "msiexec", "/update", installerPath, "/qn")
if err := updateCmd.Run(); err != nil {
tui.ShowWarning("Update approach failed, trying install with reinstall: %v", err)

reinstallCmd := exec.CommandContext(ctx, "msiexec", "/i", installerPath, "/qn", "REINSTALLMODE=amus", "REINSTALL=ALL")
if err := reinstallCmd.Run(); err != nil {
installErr = fmt.Errorf("failed to run MSI installer: %w", err)
}
}
}
}
Expand Down
Loading