DEV Community

Cover image for I Wanted "agy ." for Google Antigravity on WSL2 — So I Built "wagy"
Rachid HAMADI
Rachid HAMADI

Posted on

I Wanted "agy ." for Google Antigravity on WSL2 — So I Built "wagy"

I use WSL2 as my main development environment on Windows.

My projects live in Linux:

/home/user/Projects/...
Enter fullscreen mode Exit fullscreen mode

Node.js, pnpm, Git, Docker, and the rest of my toolchain also run inside WSL.

When I started using Google Antigravity IDE, I wanted the same workflow I already had with VS Code:

code .
Enter fullscreen mode Exit fullscreen mode

Something like:

agy .
Enter fullscreen mode Exit fullscreen mode

That would have been the obvious command.

But agy is already the official Antigravity CLI, so reusing it as a launcher for the Windows IDE would be confusing.

So I needed another name.

I ended up with:

wagy .
Enter fullscreen mode Exit fullscreen mode

You can read it as WSL + agy or Windows + agy — both actually describe what it does pretty well.

The goal was simple:

WSL2
└── ~/Projects/my-project
    │
    │ wagy .
    ▼
Antigravity IDE on Windows
    │
    └── Remote WSL
        └── /home/user/Projects/my-project
Enter fullscreen mode Exit fullscreen mode

I wanted to launch the Windows Antigravity IDE directly from my WSL terminal, while keeping the project, terminal, and development toolchain inside WSL.

Not opening the project through \\wsl.localhost.

Not moving the project to C:\.

And ideally, not patching Antigravity every time it gets updated.

After a bit of digging, the solution turned out to be quite small.

The setup

This was tested with:

Antigravity IDE 1.107.0
Windows 11
WSL2
Ubuntu
zsh
Enter fullscreen mode Exit fullscreen mode

Antigravity was installed on Windows under:

C:\Users\<user>\AppData\Local\Programs\Antigravity IDE
Enter fullscreen mode Exit fullscreen mode

From WSL, that becomes:

/mnt/c/Users/<user>/AppData/Local/Programs/Antigravity IDE
Enter fullscreen mode Exit fullscreen mode

The missing piece: --remote

Antigravity IDE already supports remote targets.

From WSL, this works:

"/mnt/c/Users/<user>/AppData/Local/Programs/Antigravity IDE/Antigravity IDE.exe" \
  --remote "wsl+$WSL_DISTRO_NAME" \
  "$(pwd)"
Enter fullscreen mode Exit fullscreen mode

That was the missing piece.

It launches the Windows Antigravity IDE while opening the project through the current WSL distribution.

So instead of opening:

\\wsl.localhost\Ubuntu\home\user\Projects\my-project
Enter fullscreen mode Exit fullscreen mode

the IDE works with the actual WSL environment:

/home/user/Projects/my-project
Enter fullscreen mode Exit fullscreen mode

This means the integrated terminal can keep using the Linux toolchain:

node
pnpm
git
docker
Enter fullscreen mode Exit fullscreen mode

Exactly what I wanted.

Turning it into wagy

Now that the command worked, I just needed a convenient wrapper.

So here's the wagy script.

Create:

~/.local/bin/wagy
Enter fullscreen mode Exit fullscreen mode

with the following content:

#!/usr/bin/env bash
set -euo pipefail

BASE="/mnt/c/Users/<user>/AppData/Local/Programs/Antigravity IDE"
CLI="$BASE/bin/antigravity-ide"
EXE="$BASE/Antigravity IDE.exe"

if [[ -z "${WSL_DISTRO_NAME:-}" ]]; then
  echo "wagy: must be run from WSL" >&2
  exit 1
fi

REMOTE="wsl+$WSL_DISTRO_NAME"

usage() {
  cat <<'HELP'
wagy - Open Antigravity IDE from WSL

Usage:
  wagy
  wagy .
  wagy <folder>
  wagy <file>
  wagy <file>:<line>
  wagy <file>:<line>:<column>

Options:
  -n, --new-window      Open in a new window
  -r, --reuse-window    Reuse an existing window
  -v, --version         Show Antigravity version
  -h, --help            Show this help

Examples:
  wagy .
  wagy ~/Projects/my-project
  wagy package.json
  wagy src/index.ts:42
  wagy src/index.ts:42:10
  wagy -n .
HELP
}

WINDOW_ARG=""

case "${1:-}" in
  -v|--version|version)
    "$CLI" --version | sed 's/\r$//'
    exit "${PIPESTATUS[0]}"
    ;;

  -h|--help)
    usage
    exit 0
    ;;

  -n|--new-window)
    WINDOW_ARG="--new-window"
    shift
    ;;

  -r|--reuse-window)
    WINDOW_ARG="--reuse-window"
    shift
    ;;
esac

TARGET="${1:-.}"

GOTO_TARGET=""

if [[ "$TARGET" =~ ^(.+):([0-9]+):([0-9]+)$ ]]; then
  FILE="${BASH_REMATCH[1]}"
  LINE="${BASH_REMATCH[2]}"
  COLUMN="${BASH_REMATCH[3]}"

  if [[ -f "$FILE" ]]; then
    FILE="$(readlink -f "$FILE")"
    GOTO_TARGET="${FILE}:${LINE}:${COLUMN}"
  fi

elif [[ "$TARGET" =~ ^(.+):([0-9]+)$ ]]; then
  FILE="${BASH_REMATCH[1]}"
  LINE="${BASH_REMATCH[2]}"

  if [[ -f "$FILE" ]]; then
    FILE="$(readlink -f "$FILE")"
    GOTO_TARGET="${FILE}:${LINE}"
  fi
fi

if [[ -n "$GOTO_TARGET" ]]; then
  args=(
    --remote "$REMOTE"
  )

  [[ -n "$WINDOW_ARG" ]] && args+=("$WINDOW_ARG")

  args+=(
    --goto "$GOTO_TARGET"
  )

  "$EXE" "${args[@]}" >/dev/null 2>&1 &
  disown

  exit 0
fi

if [[ ! -e "$TARGET" ]]; then
  echo "wagy: path not found: $TARGET" >&2
  exit 1
fi

TARGET="$(readlink -f "$TARGET")"

args=(
  --remote "$REMOTE"
)

[[ -n "$WINDOW_ARG" ]] && args+=("$WINDOW_ARG")

if [[ -f "$TARGET" ]]; then
  args+=(
    --goto "$TARGET"
  )
elif [[ -d "$TARGET" ]]; then
  args+=(
    "$TARGET"
  )
else
  echo "wagy: unsupported path: $TARGET" >&2
  exit 1
fi

"$EXE" "${args[@]}" >/dev/null 2>&1 &
disown
Enter fullscreen mode Exit fullscreen mode

Replace:

<user>
Enter fullscreen mode Exit fullscreen mode

with your Windows username.

Then make it executable:

chmod +x ~/.local/bin/wagy
Enter fullscreen mode Exit fullscreen mode

If ~/.local/bin isn't already in your PATH:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

For Bash, use ~/.bashrc instead.

Usage

Now I can open the current WSL project:

wagy .
Enter fullscreen mode Exit fullscreen mode

Open another project:

wagy ~/Projects/my-project
Enter fullscreen mode Exit fullscreen mode

Open a file:

wagy package.json
Enter fullscreen mode Exit fullscreen mode

Open a specific line:

wagy src/index.ts:42
Enter fullscreen mode Exit fullscreen mode

Or a line and column:

wagy src/index.ts:42:10
Enter fullscreen mode Exit fullscreen mode

Open a new Antigravity window:

wagy -n .
Enter fullscreen mode Exit fullscreen mode

Reuse an existing one:

wagy -r .
Enter fullscreen mode Exit fullscreen mode

And check the installed version:

wagy --version
Enter fullscreen mode Exit fullscreen mode

Verify that you're really inside WSL

After running:

wagy .
Enter fullscreen mode Exit fullscreen mode

open Antigravity's integrated terminal and check:

pwd
uname -a
which node
which pnpm
which git
Enter fullscreen mode Exit fullscreen mode

The important part is that the workspace remains something like:

/home/user/Projects/my-project
Enter fullscreen mode Exit fullscreen mode

and the binaries come from the Linux environment.

That's different from simply browsing WSL files through a Windows UNC path.

Why not just use \\wsl.localhost?

Windows can access WSL files through paths like:

\\wsl.localhost\Ubuntu\home\user\Projects\my-project
Enter fullscreen mode Exit fullscreen mode

That can be useful, but it isn't the workflow I wanted.

My development environment lives in WSL.

I want Antigravity's terminal and tools to work against:

/home/user/Projects/my-project
Enter fullscreen mode Exit fullscreen mode

with the same environment I get when I open my WSL terminal.

The --remote "wsl+..." approach gives me that.

No IDE patching required

One thing I like about this approach is that it doesn't modify Antigravity itself.

There are other WSL workarounds that involve patching Antigravity's launcher or relying on its bundled Remote WSL extension.

wagy doesn't need any of that.

It simply uses the remote support already exposed by the IDE:

Antigravity\ IDE.exe \
  --remote "wsl+Ubuntu" \
  /home/user/Projects/my-project
Enter fullscreen mode Exit fullscreen mode

That's less invasive and should also be less fragile across Antigravity updates.

Of course, Antigravity itself is evolving quickly, so CLI behavior may still change in future versions.

Final workflow

My WSL workflow now feels almost identical to VS Code:

cd ~/Projects/my-project

wagy .
Enter fullscreen mode Exit fullscreen mode

That's really all I wanted.

WSL2
│
├── Node.js
├── pnpm
├── Git
├── Docker
│
└── ~/Projects/my-project
          │
          │ wagy .
          ▼
    Antigravity IDE
          │
          └── Remote WSL
Enter fullscreen mode Exit fullscreen mode

A tiny shell wrapper, but a much nicer workflow.

Top comments (0)