Skip to main content
Glama
Local File Launcher

Local File Launcher

by nopolezz
README.md
# Local File Launcher (本地文件打开器)

An inline **Antigravity MCP App plugin** that renders clean, minimalist file action cards inside chat conversations — letting you open generated `.pptx`, `.docx`, `.xlsx`, `.pdf`, `.zip`, and image files directly in your system's default application (PowerPoint, WPS, Word, Excel, Preview, Acrobat, etc.) or open their containing folder in one click, completely bypassing Antigravity Desktop's *"Preview is not available for this file type"* screen.

> 一款适用于 **Google Antigravity** 的内嵌 MCP App 插件:在对话内渲染极简文件操作卡片(仅显示文件名,不堆冗长路径),支持一键调用系统默认软件打开 `.pptx`/`.docx`/`.xlsx`/`.pdf`/图片等文件,或一键打开所在目录,彻底绕开桌面端“此文件类型无法预览”页面。

---

## Features / 核心特性

- **Zero-Dependency Out of the Box**:Both `dist/server.mjs` and `dist/app.html` are pre-bundled — no `npm install` required for end users (requires only Node.js 18+).
- **Minimalist Inline Card**:Displays file type badge, clean filename, size, and short note — no raw directory path clutter.
- **One-Click Native Launch**:
  - **Open / 默认打开**:Launches the file with your OS default associated app (Windows `ShellExecuteW`, macOS `open`, Linux `xdg-open`).
  - **Open Folder / 打开所在目录**:Opens the containing directory and brings the Explorer window cleanly to the foreground on Windows.
- **Auto Theme & Locale Adaptation**:Automatically follows Antigravity Light/Dark themes and switches between Chinese (`zh`) and English (`en`) UI labels.
- **Automatic Trigger Rule**:Bundled `rules/AGENTS.md` automatically prompts the agent to render the card whenever it creates, edits, merges, or exports office/binary/image files.

---

## Security Model / 安全设计

1. **Human-in-the-Loop Only (`visibility: ["app"]`)**:The `open_file` tool is strictly hidden from the AI model. The model can only display the card (`show_file_actions`); **no local file or folder can ever be opened unless the user explicitly clicks a button**.
2. **Executable & Script Blocklist**:Direct launch of executable, script, and installer extensions (`.exe`, `.bat`, `.cmd`, `.ps1`, `.js`, `.vbs`, `.msi`, `.reg`, `.sh`, `.command`, `.app`, `.dmg`, `.pkg`, etc.) is blocked — users are guided to inspect them safely via **Open Folder**.
3. **Local Filesystem Only**:Rejects external URI schemes (`http://`, `https://`, `ms-msdt:`, etc.), Windows UNC network shares (`\\server\share`), and verifies symlink targets via `fs.realpathSync`.

---

## Installation / 安装方式

### Option 1: Install from GitHub via Antigravity CLI
```bash
agy plugin install https://github.com/nopolezz/local-file-launcher
```

### Option 2: Manual Local Install
Clone or copy this folder directly into your global Antigravity plugins directory:
- **Windows**: `C:\Users\<YourUser>\.gemini\config\plugins\local-file-launcher`
- **macOS / Linux**: `~/.gemini/config/plugins/local-file-launcher`

Antigravity automatically discovers `plugin.json` without manual registration.

---

## Development & Building / 本地开发与打包

```bash
npm install
npm run build
```

This rebuilds both self-contained artifacts under `dist/`:
- `dist/app.html` — single-file MCP App UI bundle
- `dist/server.mjs` — zero-dependency Node.js ESM MCP server bundle

---

---

## License

[MIT](./LICENSE)