$ show cafeTechne/antigravity-link-extension
This repository contains a VS Code extension that acts as a bridge between the Antigravity IDE and a mobile device, enabling remote interaction via a local HTTPS server. The extension starts a self-signed HTTPS server on the LAN, uses the Chrome DevTools Protocol (CDP) to inspect and manipulate Antigravity IDE instances, and leverages the Language Server Protocol (LSP) to monitor and control code generation processes. A companion mobile web interface, served by the local server, provides real-time chat mirroring, message sending, file uploads, voice input, and generation control through a WebSocket connection. The architecture consists of three main parts: the VS Code extension (managing the server lifecycle and IDE integrations), the Express/WebSocket server (handling API requests, real-time communication, and static file serving), and the mobile SPA (rendering the IDE state and forwarding user interactions). Key capabilities include QR-code based pairing, end-to-end encrypted local communication, multi-instance switching, and programmatic control via an MCP server that exposes the API over stdio JSON-RPC. The extension demonstrates solid engineering practices with TypeScript, modular service layers, middleware for authentication and security, and a test suite covering core functionality. While tightly coupled to Antigravity's UI and protocols by necessity, it isolates concerns through well-defined services (CDP, LSP, antigravity interactions) and reusable patterns such as the CSP middleware, CDP wrapper, and stdio JSON-RPC proxy. Ongoing maintenance addresses selector fragility and API updates, ensuring compatibility with evolving IDE and VS Code versions.
The LLM identified 3 files worth highlighting for reuse:
Sets a strict Content Security Policy (CSP) header on all HTTP responses to mitigate XSS risks. This middleware is isolated, has no internal dependencies, and can be directly reused in any Express.js application needing basic security hardening.
Encapsulates Chrome DevTools Protocol (CDP) connection management, including instance discovery, command execution with timeout handling, and context lifecycle. This wrapper abstracts the low-level CDP client, making it reusable for any project requiring automated Chrome control or debugging.
Implements a stdio-based JSON-RPC 2.0 server that proxies method calls to the local HTTP API with Bearer token authentication. This pattern enables exposing existing RESTful services over standard input/output for integration with MCP-compatible hosts, and can be adapted to other HTTP APIs by updating endpoint mappings.