The user has installed a tool called Antigravity (which acts similar to VS Code or Cursor). The underlying CLI command is antigravity (or antigravity.cmd on Windows).
The goal is to map ag . so that it seamlessly opens the current directory in Antigravity across three environments:
- Windows Command Prompt (
cmd.exe) - Windows PowerShell (
powershell.exe/pwsh) - Windows Subsystem for Linux (WSL / Bash)
When a user types
ag ., it should invokeantigravity .automatically, exactly like howcode .orcursor .works.
To successfully implement this integration without causing environment inconsistencies, execute the following steps:
Before writing anything, locate the original antigravity executable.
- On Windows, it is typically located in:
C:\Users\<username>\AppData\Local\Programs\Antigravity\bin\antigravity.cmd - Confirm that this directory is already in the system
%PATH%(if the user can typeantigravityglobally, it is).
Do not use doskey via Registry AutoRun as it can be overriding/intrusive and only applies to interactive CMD sessions.
Correct Approach: Create a wrapper batch script inside the directory where the original executable lives.
- Path:
%LOCALAPPDATA%\Programs\Antigravity\bin\ag.cmd - Content:
@echo off antigravity %*
Why this works: Because the bin directory is already in the Windows %PATH%, adding ag.cmd here makes ag globally accessible across CMD, PowerShell, and even the Windows GUI "Run" dialog without needing profile load times.
While the wrapper batch script above technically makes ag work in PowerShell, you should also add a PowerShell-native function to the user's profile to ensure seamless argument passing and tab-completion if needed.
- Profile Location: Check
$PROFILE(usuallyC:\Users\<username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1). Create the directory and file if it does not exist. - Content:
function ag { & antigravity $args }
- Note: Ensure the execution policy allows running local scripts (e.g.,
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned).
In WSL, Windows paths are generally appended to the $PATH automatically, allowing WSL to execute antigravity out of the box. However, Windows batch files don't resolve natively via simple aliases. Since antigravity exists as an executable in the path, simply alias it.
- Profile Location:
~/.bashrc - Content to Append:
alias ag='antigravity'
- Note: Do not forget to advise the user to run
source ~/.bashrcor restart their WSL session for changes to take effect.
- Executable Misidentification: Verify that you are aliasing to
antigravity, NOTcode. If the user asks for "Antigravity", do not assume it uses thecodeexecutable under the hood unless explicitly stated. - Tool Validation Constraints: Some agent tooling blocks editing files outside of the active workspace. If you hit security constraints using
run_commandto inspectAppData, remember thatwrite_to_filecan often succeed for specific absolute paths. - Doskey vs Scripts:
doskeymacros fail in sub-shells orcmd /cexecutions. Always favor physical wrapper scripts (.cmd) in valid%PATH%directories over registry hacks.