Skip to content

feat(antigravity): add cross-platform Windows support for agy CLI plugin - #184

Open
Joy Mondal (Equlient-Joy) wants to merge 6 commits into
microsoft:mainfrom
Equlient-Joy:feat/antigravity-crossplatform-windows
Open

Joy Mondal (Equlient-Joy) wants to merge 6 commits into
microsoft:mainfrom
Equlient-Joy:feat/antigravity-crossplatform-windows

Conversation

@Equlient-Joy

@Equlient-Joy Joy Mondal (Equlient-Joy) commented Nov 9, 2026 •

Copy link
Copy Markdown

feat(antigravity): add cross-platform Windows support for agy CLI plugin

Extends the experimental antigravity host adapter (#147) with robust cross-platform Windows support for the agy CLI plugin.

Background & Context

In #147, the Antigravity host adapter was introduced with a limitation noting "macOS and Linux only: on Windows agy runs hook commands through cmd /c, and this plugin's launcher is a POSIX shell script."

Following review feedback from Aaron Li (@aaron-jx-li), this PR adds native Windows batch launchers and cross-platform hooks for agy CLI while keeping changes strictly focused, cleanly separating CLI support from Desktop 2.0 app tool mappings, and avoiding side effects across platforms.

Key Changes

  1. Inverted Launcher Execution in plugin/hooks.json:

    • The launcher order runs the POSIX launcher first:
      "./scripts/te-hook --host antigravity --event <event> || scripts\\te-hook.cmd --host antigravity --event <event>"
    • On macOS and Linux, the POSIX script succeeds and the || branch never executes. This eliminates the previous 2>nul redirect that inadvertently created a stray nul file on POSIX systems.
    • On Windows, cmd.exe /c fails to execute the ./scripts/te-hook POSIX path and falls through cleanly to scripts\te-hook.cmd.
  2. Native Windows Batch Launchers (plugin/scripts/te-hook.cmd & te.cmd):

    • Implemented native Windows batch launchers matching the te-hook and te POSIX launchers.
    • Uses setlocal EnableDelayedExpansion and !ERRORLEVEL! handling to ensure accurate exit code propagation without being shadowed by batch expansion quirks.
  3. Python >= 3.10 Probing with Graceful Fallback:

    • Probes TE_PYTHON, py -3, python.exe, and python3.exe for Python >= 3.10 via an inline sys.version_info probe, filtering out non-functional WindowsApps store alias stubs.
    • If only an older Python version is found, hands off execution to that interpreter so te_bootstrap.py can fail open on hooks or output human-readable requirement errors on CLI commands, aligning with PR Launchers: skip a python3 older than the bootstrap needs #194.
  4. Line Endings in .gitattributes:

    • Explicitly configured *.cmd text eol=crlf in .gitattributes to ensure Windows batch files preserve CRLF line endings across git checkouts.
  5. Scoped Documentation Strictly to Tested Versions:

    • Scoped documentation across README.md, plugin/README.md, and docs/PLUGIN.md to verified versions: agy 1.5.1 and 1.5.2 on Windows 11, macOS, and Linux.
    • Documented invocation of scripts\te.cmd --host antigravity <command> from the plugin directory for Windows terminal users.
  6. Deferred Antigravity 2.0 Desktop Tool Mappings:

    • Tool mappings (write_file, edit_file) and product detection have been removed from this PR and deferred to a dedicated follow-up PR backed by real transcript fixtures.

Verification Results

  • Pytest Test Suite:
    • pytest tests/test_antigravity.py tests/test_plugin_package.py -v: 55 passed, 3 skipped (Windows ACL / symlink privilege skips).
  • Windows Launcher Tests:
    • test_windows_hook_launcher_fails_open_with_no_python: passes (exits 0 with {}).
    • test_windows_te_launcher_reports_missing_python: passes (exits 1 with clear stderr message).
    • test_windows_hook_launcher_executes_with_valid_python: passes (executes hook payload cleanly and outputs valid response).
    • test_the_plugin_declares_the_three_events_and_never_pretooluse: passes with updated inverted hook syntax.
  • Git Hygiene:
    • Changes are minimal, focused, and only touch intended files (8 files changed: .gitattributes, README.md, docs/PLUGIN.md, plugin/README.md, plugin/hooks.json, plugin/scripts/te-hook.cmd, plugin/scripts/te.cmd, tests/test_antigravity.py).

Copilot AI balanced review requested due to automatic review settings November 9, 2026 14:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@Equlient-Joy

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@aaron-jx-li Aaron Li (aaron-jx-li) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. This PR needs a bit of refinements before it can be merged:

  1. plugin/hooks.json is what agy runs on macOS and Linux too, through sh -c. There, scripts\te-hook.cmd becomes scriptste-hook.cmd, which is not found, and 2>nul writes a file named nul into the plugin directory on every hook call. One option to try (we haven't tested it on Windows): put the POSIX launcher first (./scripts/te-hook … || scripts\te-hook.cmd …). te-hook fails open with exit 0, so sh never reaches the Windows half.
  2. In both .cmd files, every exit /b %ERRORLEVEL% sits inside a ( … ) block. cmd expands it when it reads the block, before Python runs, so the launcher always exits 0. Please use setlocal EnableDelayedExpansion with !ERRORLEVEL!, or move the call out of the block.
  3. Please have the Windows launcher pick the first Python >= 3.10, as #194 does for POSIX.
  4. Please keep the docs to what was tested: the agy version and Windows version you ran, and no "dual .cmd/.sh launchers" (there is no .sh launcher). The docs also still send Windows users to ~/.tokeneconomizer/bin/te, which is a /bin/sh script.
  5. Please move the Antigravity 2.0 parts (write_file/edit_file, the product detection) to a separate PR, with a redacted real transcript showing those tool names. Nothing in the repo shows them yet, and the product branch never runs because hooks.json always passes --host antigravity.
  6. Please mark the .cmd files eol=crlf in .gitattributes.

Joy Mondal added 6 commits November 14, 2026 22:38
… Antigravity 2.0

Add Windows batch hook and CLI launchers (plugin/scripts/te-hook.cmd, te.cmd) to support cmd.exe /c execution. Update plugin/hooks.json to execute cleanly across Windows, macOS, and Linux. Add support for Antigravity 2.0 native tool signatures (write_file, edit_file) and document universal cross-platform support.
@Equlient-Joy
Joy Mondal (Equlient-Joy) force-pushed the feat/antigravity-crossplatform-windows branch from 1f16760 to 3c1ad11 Compare November 14, 2026 18:42
@Equlient-Joy Joy Mondal (Equlient-Joy) changed the title feat(antigravity): add cross-platform Windows support for agy CLI and Antigravity 2.0 feat(antigravity): add cross-platform Windows support for agy CLI plugin Nov 14, 2026
@Equlient-Joy

Copy link
Copy Markdown
Author

Thanks for the thorough review and guidance Aaron Li (@aaron-jx-li)! All 6 feedback items have been addressed and the branch has been rebased on the latest \main:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants