Skip to main content
Glama
Antigravity Open in Default App

Antigravity Open in Default App

by wuying1991

Antigravity Open in Default App (antigravity-open-default)

跨平台 Antigravity 原生插件(macOS / Windows / Linux)
让 Antigravity 生成的 HTML、PDF、Office 文档、图片等结果文件,点一下直接用系统默认软件(Chrome / Edge / Safari / Preview 等)打开,或通过下拉菜单选择「打开方式」,不再跳进代码源码页。

A cross-platform Google Antigravity plugin (MCP App + Rule + PostToolUse Hook) that displays interactive launcher cards in chat and a side-pane file list so you can open generated .html pages and deliverables directly in your OS default application — or pick another installed app via Open With — instead of landing in the built-in code viewer.


Features / 核心特性

  • One-Click Default App Launch(一键默认软件打开)

    • Click the filename or 浏览器打开 / 默认软件打开 button to launch via native OS handlers:

      • macOS: /usr/bin/open

      • Windows: PowerShell Start-Process (with env-var path passing — safe for spaces, CJK characters, and special symbols)

      • Linux: xdg-open

  • Native "Open With" Dropdown(选择打开方式)

    • Click the ▾ split-button arrow to open a vertical dropdown showing the top 5 compatible apps installed on your machine (browsers prioritized for .html), with a "选择更多应用…" toggle for the rest:

      • macOS: Queries NSWorkspace / LaunchServices dynamically (auto-filters nested helpers and updater duplicates)

      • Windows: Queries Windows Registry (UserChoice, OpenWithProgids, OpenWithList, StartMenuInternet) dynamically

  • Reveal in Finder / File Explorer & Back to Source(定位文件 / 切回源码)

    • Finder (macOS) / 资源管理器 (Windows): highlights the file directly (open -R / explorer.exe /select,"...").

    • 源码: opens Antigravity's built-in file viewer (fileView) whenever you do want to inspect source code.

  • Batch Anti-Spam Protection(批量防刷屏)

    • Always-on rule enforces at most 1 card per turn and prioritizes entry-point files (e.g., index.html).

    • Lists with > 3 files automatically prioritize .html files and collapse to the top 3 with an expandable "展开其余 N 个文件" toggle.

    • Lists with > 5 files replace "全部打开" with "打开所在目录" so you never accidentally pop open 20 tabs at once.

  • Side Pane Launcher(右侧栏「系统外开文件」)

    • Open from Antigravity's side pane + menu → 系统外开文件.

    • A silent PostToolUse hook automatically tracks generated .html, .pdf, Office docs, and images across all conversations without ever stealing window focus.

    • Includes search, category filters (HTML / 文档 / 图片 / 其他), quick path open, and directory scan.

  • Safe by Design(安全机制)

    • All launch/reveal tools use visibility: ["app"] — only user clicks in the UI can invoke them; the LLM cannot execute arbitrary launches directly.

    • Zero shell interpolation; blocks direct execution of executable/script file types (.exe, .bat, .cmd, .ps1, .vbs, .js, .sh, .app, .command, .dmg, .pkg, etc.).


Related MCP server: filesystem-mcp

Installation / 安装方式

Antigravity automatically discovers plugins placed under ~/.gemini/config/plugins/ (macOS/Linux) or %USERPROFILE%\.gemini\config\plugins\ (Windows). No app restart is required; tools and rules activate on your next message.

macOS / Linux

git clone https://github.com/wuying1991/antigravity-open-default.git \
  ~/.gemini/config/plugins/antigravity-open-default
cd ~/.gemini/config/plugins/antigravity-open-default
npm install --omit=dev

Windows (PowerShell)

git clone https://github.com/wuying1991/antigravity-open-default.git `
  "$env:USERPROFILE\.gemini\config\plugins\antigravity-open-default"
Set-Location "$env:USERPROFILE\.gemini\config\plugins\antigravity-open-default"
npm install --omit=dev

Note on Node runtime: mcp_config.json uses Antigravity's built-in cross-platform agy-node runtime, so it works reliably on both macOS and Windows even when system node is not in the GUI PATH. You only need npm once to install the 3 runtime dependencies (@modelcontextprotocol/sdk, @modelcontextprotocol/ext-apps, zod). Pre-built UI bundles (dist/card.html, dist/pane.html) are included in the repository.


Usage / 使用方法

  1. Ask Antigravity in any conversation to generate an .html page (or PDF, chart, spreadsheet, etc.).

  2. At the end of the reply, an inline Open in Default App card appears automatically:

    • Click the filename or 浏览器打开 / 默认软件打开 → opens in your OS default app.

    • Click ▾ → pick any of the top 5 installed apps, or expand to view all compatible apps.

    • Click Finder / 资源管理器 → reveals the file on disk.

    • Click 源码 → opens the file in Antigravity's built-in code viewer.

  3. Click + in Antigravity's right auxiliary pane → select 系统外开文件 anytime to browse, filter, and reopen recent outputs across conversations.

  4. Manage, toggle, or uninstall anytime in Antigravity's Customizations → Plugins page.


Development & Testing / 本地开发与测试

npm install
npm run build   # Rebuild self-contained dist/card.html and dist/pane.html
npm test        # Run cross-platform unit tests, hook test, and MCP stdio E2E test

Project Layout

antigravity-open-default/
├── plugin.json           # Antigravity plugin manifest
├── mcp_config.json       # Cross-platform MCP server launch config (agy-node)
├── hooks.json            # Silent PostToolUse deliverable tracker
├── rules/AGENTS.md       # Always-on rule (HTML-first, 1 card/turn anti-spam)
├── hooks/track-output.mjs
├── src/
│   ├── platform.mjs      # macOS / Windows / Linux launch, reveal, and Open With discovery
│   ├── store.mjs         # Persistent recent file history and metadata enrichment
│   ├── server.mjs        # MCP stdio server & MCP App tool/resource registration
│   ├── card-ui.js        # Inline MCP App card UI
│   ├── pane-ui.js        # Side-pane MCP App launcher UI
│   └── styles.css        # Native Antigravity light/dark theme variables
├── dist/
│   ├── card.html         # Self-contained inline card bundle
│   └── pane.html         # Self-contained side-pane bundle
├── build.mjs             # Zero-binary HTML single-file builder
└── test/smoke.test.mjs   # End-to-end verification suite

License

MIT © wuying1991

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables ChatGPT web chat to access approved local files and run allowlisted commands through a secure loopback MCP bridge, with read-only enforcement and opt-in write capabilities.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables ChatGPT Desktop to read, search, edit and move files on your own computer, produce Word, Excel, PowerPoint, PDF and chart outputs, launch and manage terminal programs and processes, and run work on other machines you own by name over SSH. Everything runs locally under your own setup, with a Docker-isolated, offline document mode or a full-permission mode for file and code operations.
      80
      MIT