Skip to main content
Glama
Antigravity File Explorer

Antigravity File Explorer

by Anon2Tokyo
README.md
# Antigravity File Explorer

A lightweight **MCP App** plugin for **Google Antigravity** that adds a Codex-style workspace file explorer, **CodeMirror 6** viewer/editor, **Markdown & image/PDF previewer**, and **Git diff inspector** directly into Antigravity's right sidebar (`aux_pane`) and left sidebar (`global`).

## Features

- **Native Sidebar Entrypoints**: Opens directly from Antigravity's right sidebar **`+` menu** (`aux_pane`) or left sidebar (`global`), and automatically inherits Antigravity's Light/Dark theme & CSS variables.
- **Auto Workspace Detection**: Automatically detects your active/recent Antigravity workspace from `~/.gemini/antigravity/conversation_summaries.db`, with a quick workspace switcher and custom path navigation.
- **File Tree & Quick Search**:
  - Expandable directory tree with Git status indicators (`M`, `A`, `U`, `D`) and folder change dots
  - New file / new folder / rename / delete / toggle dotfiles
  - `Ctrl+P` / `Ctrl+K` quick open by filename and `Ctrl+Shift+F` workspace text search
  - Lightweight auto-sync polling so files modified by the agent refresh automatically
- **CodeMirror 6 Viewer & Editor**:
  - Fast, minimal DOM editor with syntax highlighting for JS/TS/JSX/TSX, Python, Go, Rust, Java, C/C++, JSON, YAML, HTML, CSS, SQL, XML, and Markdown
  - Multi-tab viewing, code folding, line numbers, word wrap toggle, search (`Ctrl+F`), and save (`Ctrl+S`)
- **Codex-Style Git Changes & Diff View**:
  - Dedicated **Changes** tab listing all modified/untracked files on the current branch
  - Inline unified diff view (`@codemirror/merge`) against `HEAD` with `+add / -del` stats
- **Rich Previews**:
  - **Markdown**: Switch between **Preview**, **Source**, and **Split** views
  - **Images & SVG**: Checkerboard canvas with zoom controls (plus SVG source view)
  - **PDF**: Embedded browser preview (up to 5 MB)
- **Antigravity Chat Integrations**:
  - **Attach**: Attach the open file or currently selected lines (`Lstart-Lend`) as context for your next chat message (`updateModelContext`)
  - **Ask AI**: Send a prompt about the current file or selection directly to the conversation (`sendMessage`)
  - **Native Tab**: Open any file in Antigravity's native `fileView` tab (`com.google.antigravity/toggle-aux-pane`)
- **Zero Context Pollution**: All file-system and Git backend tools are marked `visibility: ["app"]`, so only the UI calls them — they never consume model tokens.

## Installation

### Option 1: Clone directly as a plugin (Quickest)

Requires **Node.js 20+** (Node.js 22+ recommended for built-in `node:sqlite` workspace auto-detection).

```bash
git clone https://github.com/Anon2Tokyo/antigravity-file-explorer.git ~/.gemini/config/plugins/antigravity-file-explorer
```

> Prebuilt `dist/server.mjs` and `dist/index.html` are included (or can be rebuilt locally via `npm install && npm run build`). Antigravity automatically discovers plugins placed under `~/.gemini/config/plugins/`.

### Option 2: Build from source & install

```bash
git clone https://github.com/Anon2Tokyo/antigravity-file-explorer.git
cd antigravity-file-explorer
npm install
npm run install-plugin
```

`npm run install-plugin` builds both the single-file HTML MCP App (`dist/index.html`) and standalone MCP server (`dist/server.mjs`) and copies the plugin bundle into `~/.gemini/config/plugins/antigravity-file-explorer`.

## Usage in Antigravity

1. Click the **`+`** button in Antigravity's **right auxiliary pane** and select **File Explorer** (or open it full-page from the **left sidebar**).
2. Or ask Antigravity in chat: *"Open the file explorer for this workspace"* (calls `open_file_explorer`).

### Keyboard Shortcuts

| Shortcut | Action |
| :--- | :--- |
| `Ctrl/Cmd + P` or `Ctrl/Cmd + K` | Quick Open file by name/path |
| `Ctrl/Cmd + Shift + F` | Search text across workspace |
| `Ctrl/Cmd + S` | Save active file |
| `Ctrl/Cmd + B` | Toggle file tree sidebar |
| `Ctrl/Cmd + F` | Find/replace inside active editor |

## Architecture

This plugin uses the **MCP Apps (SEP-1865)** specification over stdio — no local HTTP ports required:

- `src/server/`: Standalone Node.js MCP Server serving the UI resource (`ui://antigravity-file-explorer/app.html`), the public `open_file_explorer` entrypoint tool, and `app`-only filesystem/Git tools.
- `src/ui/`: React + CodeMirror 6 frontend bundled by `esbuild` into a single self-contained HTML document (`dist/index.html`).

## Development

```bash
npm run typecheck      # Run TypeScript checks
npm run build          # Rebuild dist/index.html and dist/server.mjs
npm run install-plugin # Rebuild and copy into ~/.gemini/config/plugins/antigravity-file-explorer
```

For fast UI iteration without restarting the MCP server, you can set the environment variable `ANTIGRAVITY_EXPLORER_HTML` to point to your local `dist/index.html` path; reopening the pane picks up rebuilt HTML immediately.

## License

MIT