Non-invasive MCP accelerator plugin for Google Antigravity (CLI/Desktop/IDE): cuts LLM turns (-34%), token quota (-31%), and upload traffic (-40%) without affecting native UI or diffs.
TypeScript ai-agentai-codingantigravityantigravity-cliantigravity-ideantigravity-pluginscoding-agentcontext-optimizationdeveloper-productivitydeveloper-toolsgeminigoogle-antigravitylatency-optimizationmcpmcp-pluginmcp-servermodel-context-protocolperformanceplugintoken-optimization
# agy-fast one-command installer for Windows PowerShell
# Local usage:
# .\install.ps1
# .\install.ps1 --project C:\path\to\repo
# .\install.ps1 doctor
# .\install.ps1 uninstall
# Remote usage:
# irm https://raw.githubusercontent.com/INK-Q/agy-fast/main/install.ps1 | iex
$__agyFastScriptPath = ""
if ($null -ne $MyInvocation.MyCommand -and $null -ne $MyInvocation.MyCommand.PSObject.Properties["Path"]) {
$__agyFastScriptPath = [string]$MyInvocation.MyCommand.Path
}
$__agyFastScriptRoot = if ($null -ne $PSScriptRoot) { [string]$PSScriptRoot } else { "" }
$__agyFastIsFile = -not [string]::IsNullOrEmpty($__agyFastScriptPath)
$__agyFastAcceptArgs = $__agyFastIsFile -or ($MyInvocation.InvocationName -eq "&")
$__agyFastArgList = New-Object 'System.Collections.Generic.List[string]'
if ($__agyFastAcceptArgs -and $null -ne $args) {
foreach ($__agyFastItem in $args) {
if ($null -ne $__agyFastItem) {
$__agyFastArgList.Add([string]$__agyFastItem)
}
}
}
[string[]]$__agyFastRawArgs = $__agyFastArgList.ToArray()
$__agyFastState = @{ ExitCode = 0 }
& {
param(
[string[]]$InputArgs = @(),
[string]$ScriptRoot = "",
[bool]$IsFile = $false,
[hashtable]$State
)
$ErrorActionPreference = "Stop"
$defaultRepo = "https://github.com/INK-Q/agy-fast.git"
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
Write-Error "Node.js >= 20 is required. Install Node.js first: https://nodejs.org/" -ErrorAction Continue
$State.ExitCode = 1
return
}
$prevEap = $ErrorActionPreference
$ErrorActionPreference = "Continue"
try {
$nodeMajorRaw = (& node -p "process.versions.node.split('.')[0]" | Out-String).Trim()
$nodeCheckExit = $LASTEXITCODE
} finally {
$ErrorActionPreference = $prevEap
}
$nodeMajor = 0
if ($nodeCheckExit -ne 0 -or -not [int]::TryParse($nodeMajorRaw, [ref]$nodeMajor) -or $nodeMajor -lt 20) {
$nodeVer = (& node -v 2>$null | Out-String).Trim()
Write-Error "Node.js >= 20 is required (found $nodeVer)." -ErrorAction Continue
$State.ExitCode = 1
return
}
$subcommands = @("install", "update", "config", "mcp", "mcp-config", "uninstall", "status", "doctor", "-h", "--help")
$hasSubcmd = ($InputArgs.Length -gt 0) -and ($subcommands -contains $InputArgs[0])
$forwardList = New-Object 'System.Collections.Generic.List[string]'
if (-not $hasSubcmd) {
$forwardList.Add("install")
}
foreach ($a in $InputArgs) {
$forwardList.Add([string]$a)
}
[string[]]$forwardArgs = $forwardList.ToArray()
function Invoke-NodeInstaller {
param(
[string]$InstallerPath,
[string[]]$ForwardArgs,
[hashtable]$RunState
)
# Always build a >= 2 element [string[]] so Windows PowerShell 5.1 never
# unwraps a 1-element array to a scalar [string] and splats it char-by-char
# (e.g. "install" -> 'i' 'n' 's' 't' 'a' 'l' 'l').
$argList = New-Object 'System.Collections.Generic.List[string]'
$argList.Add($InstallerPath)
foreach ($fa in $ForwardArgs) {
$argList.Add([string]$fa)
}
[string[]]$nodeArgs = $argList.ToArray()
$savedEap = $ErrorActionPreference
$ErrorActionPreference = "Continue"
try {
& node @nodeArgs
$RunState.ExitCode = $LASTEXITCODE
} finally {
$ErrorActionPreference = $savedEap
}
}
function Test-LocalAgyFastRepo {
param(
[string]$Candidate
)
if ([string]::IsNullOrWhiteSpace($Candidate)) {
return $false
}
$manifestPath = Join-Path $Candidate "plugin.json"
$installerPath = Join-Path (Join-Path $Candidate "scripts") "install.mjs"
if (-not (Test-Path -LiteralPath $manifestPath -PathType Leaf) -or -not (Test-Path -LiteralPath $installerPath -PathType Leaf)) {
return $false
}
try {
$rawManifest = Get-Content -LiteralPath $manifestPath -Raw -Encoding UTF8 -ErrorAction Stop
if ([string]::IsNullOrWhiteSpace($rawManifest)) {
return $false
}
$trimmedManifest = $rawManifest.TrimStart([char]0xFEFF).TrimStart()
if (-not $trimmedManifest.StartsWith("{")) {
return $false
}
$manifest = ConvertFrom-Json -InputObject $trimmedManifest -ErrorAction Stop
if (-not ($manifest -is [pscustomobject])) {
return $false
}
foreach ($prop in $manifest.PSObject.Properties) {
if (($prop.Name -ceq "name") -and ($prop.Value -is [string]) -and ($prop.Value -ceq "agy-fast")) {
return $true
}
}
return $false
} catch {
return $false
}
}
# Never fall back to CWD when invoked via `irm ... | iex` ($IsFile is $false).
# Only trust a local scripts/install.mjs when running an explicit install.ps1 file
# whose sibling plugin.json strictly identifies name === "agy-fast".
if ($IsFile -and -not [string]::IsNullOrWhiteSpace($ScriptRoot) -and (Test-LocalAgyFastRepo -Candidate $ScriptRoot)) {
$localInstaller = Join-Path (Join-Path $ScriptRoot "scripts") "install.mjs"
Invoke-NodeInstaller -InstallerPath $localInstaller -ForwardArgs $forwardArgs -RunState $State
return
}
$isWin = ($PSVersionTable.PSVersion.Major -lt 6) -or $IsWindows
$userHome = if ($isWin) {
if (-not [string]::IsNullOrWhiteSpace($env:USERPROFILE)) {
$env:USERPROFILE
} elseif ((-not [string]::IsNullOrWhiteSpace($env:HOMEDRIVE)) -and (-not [string]::IsNullOrWhiteSpace($env:HOMEPATH))) {
($env:HOMEDRIVE + $env:HOMEPATH).Trim()
} elseif (-not [string]::IsNullOrWhiteSpace($env:HOME)) {
$env:HOME
} else {
[Environment]::GetFolderPath('UserProfile')
}
} else {
if (-not [string]::IsNullOrWhiteSpace($env:HOME)) {
$env:HOME
} elseif (-not [string]::IsNullOrWhiteSpace($HOME)) {
$HOME
} elseif (-not [string]::IsNullOrWhiteSpace($env:USERPROFILE)) {
$env:USERPROFILE
} else {
[Environment]::GetFolderPath('UserProfile')
}
}
$defaultTarget = if (-not [string]::IsNullOrWhiteSpace($userHome)) {
Join-Path $userHome (Join-Path ".gemini" (Join-Path "config" (Join-Path "plugins" "agy-fast")))
} else {
""
}
$installedInstaller = if (-not [string]::IsNullOrWhiteSpace($defaultTarget)) {
Join-Path (Join-Path $defaultTarget "scripts") "install.mjs"
} else {
""
}
if ($hasSubcmd -and ($InputArgs[0] -ne "install") -and (-not [string]::IsNullOrEmpty($installedInstaller)) -and (Test-Path -LiteralPath $installedInstaller -PathType Leaf)) {
Invoke-NodeInstaller -InstallerPath $installedInstaller -ForwardArgs $forwardArgs -RunState $State
return
}
$repoUrl = if (-not [string]::IsNullOrWhiteSpace($env:AGY_FAST_REPO)) { $env:AGY_FAST_REPO.Trim() } else { $defaultRepo }
if ($repoUrl.StartsWith("-")) {
Write-Error "Invalid AGY_FAST_REPO value: repository URL must not start with '-'." -ErrorAction Continue
$State.ExitCode = 1
return
}
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
Write-Error "git is required for remote installation." -ErrorAction Continue
$State.ExitCode = 1
return
}
$tmpClone = Join-Path ([System.IO.Path]::GetTempPath()) ("agy-fast-install-" + [System.Guid]::NewGuid().ToString("N"))
try {
Write-Host "Cloning agy-fast from $repoUrl..."
$savedEap = $ErrorActionPreference
$ErrorActionPreference = "Continue"
try {
& git clone --depth 1 -- $repoUrl $tmpClone
$gitExit = $LASTEXITCODE
} finally {
$ErrorActionPreference = $savedEap
}
if ($gitExit -ne 0) {
Write-Error "git clone failed with exit code $gitExit." -ErrorAction Continue
$State.ExitCode = $gitExit
return
}
$clonedInstaller = Join-Path (Join-Path $tmpClone "scripts") "install.mjs"
Invoke-NodeInstaller -InstallerPath $clonedInstaller -ForwardArgs $forwardArgs -RunState $State
} finally {
if (Test-Path -LiteralPath $tmpClone) {
Remove-Item -LiteralPath $tmpClone -Recurse -Force -ErrorAction SilentlyContinue
}
}
} -InputArgs $__agyFastRawArgs -ScriptRoot $__agyFastScriptRoot -IsFile $__agyFastIsFile -State $__agyFastState
$__agyFastFinalExit = $__agyFastState.ExitCode
$__agyFastWasFile = $__agyFastIsFile
Remove-Variable -Name __agyFastScriptPath, __agyFastScriptRoot, __agyFastIsFile, __agyFastAcceptArgs, __agyFastArgList, __agyFastItem, __agyFastRawArgs, __agyFastState -ErrorAction SilentlyContinue
if ($__agyFastWasFile) {
Remove-Variable -Name __agyFastWasFile -ErrorAction SilentlyContinue
exit $__agyFastFinalExit
}
Remove-Variable -Name __agyFastFinalExit, __agyFastWasFile -ErrorAction SilentlyContinue