antigravity-plugin-context-mode 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to `antigravity-plugin-context-mode` will be documented in this file.
4
4
 
5
+ ## [1.3.2] - 2026-11-17
6
+
7
+ ### Documentation
8
+ - **User-Friendly Documentation**: Streamlined `README.md` to focus on end-user benefits, 1-click `npx` installation (global & workspace modes), real-world token savings benchmarks, and interactive sidecar controls.
9
+ - **Synchronized Manifest Version**: Updated `plugin.json` version to match release tag.
10
+
11
+ ## [1.3.1] - 2026-11-16
12
+
13
+ ### Added
14
+ - **1-Click CLI Installer (`npx antigravity-plugin-context-mode install`)**: Added automated CLI installation handler to `server.js`. Running `npx antigravity-plugin-context-mode install` automatically detects the user's OS and copies plugin manifests, hooks, skills, and MCP tools directly into `~/.gemini/config/plugins/antigravity-plugin-context-mode` (or workspace-scoped via `--workspace`).
15
+ - **CLI Uninstaller (`npx antigravity-plugin-context-mode uninstall`)**: Easily remove the installed plugin from the Antigravity discovery directory with clean terminal confirmation.
16
+ - **CLI Flags (`--help`, `-h`, `--version`, `-v`)**: Quick terminal reference for command options while maintaining 100% backward compatibility with MCP stdio JSON-RPC protocol execution.
17
+
5
18
  ## [1.3.0] - 2026-11-15
6
19
 
7
20
  ### Added
package/README.md CHANGED
@@ -1,74 +1,81 @@
1
1
  # Antigravity Context Mode
2
2
 
3
- > **Stop context bloat. Save 90%+ of your prompt tokens. Keep your agent fast, focused, and less forgetful.**
3
+ > **Stop context bloat. Save 90%+ of your prompt tokens. Keep your agent fast, focused, and sharp.**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/antigravity-plugin-context-mode.svg)](https://www.npmjs.com/package/antigravity-plugin-context-mode)
6
+ [![Live Simulator](https://img.shields.io/badge/Live%20Simulator-domush.github.io-10b981?style=flat&logo=github)](https://domush.github.io/antigravity-plugin-context-mode/)
6
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
7
8
  [![Zero Runtime Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)]()
8
9
  [![Antigravity App Compatible](https://img.shields.io/badge/Antigravity%20App-Native%20Plugin-6366f1.svg)]()
9
10
 
10
- **Antigravity Context Mode** is a free, local-first plugin built specifically for the **Google Antigravity App**. It prevents terminal commands, build outputs, multi-megabyte source files, and massive datasets from flooding your conversation history — saving thousands of tokens per turn and stopping "agent amnesia" in its tracks.
11
+ **Antigravity Context Mode** is a free, local-first plugin built specifically for the **Google Antigravity App**. It prevents terminal commands, build logs, and multi-megabyte source files from flooding your conversation history — saving thousands of tokens per turn and stopping "agent amnesia" in its tracks.
12
+
13
+ > 🌐 **Interactive Live Simulator & Documentation:** [domush.github.io/antigravity-plugin-context-mode](https://domush.github.io/antigravity-plugin-context-mode/)
14
+
15
+ <img width="846" height="503" alt="image" src="https://github.com/user-attachments/assets/2b89e947-4b53-42a6-a0ad-ea744de96c41" />
16
+ ---
17
+
18
+ ## Quick Install (10 Seconds)
19
+
20
+ Install directly into Google Antigravity using `npx`:
21
+
22
+ ```bash
23
+ # Global install (available across all Antigravity chats)
24
+ npx antigravity-plugin-context-mode install
25
+
26
+ # Or per-project install (scoped to current workspace only)
27
+ npx antigravity-plugin-context-mode install --workspace
28
+ ```
29
+
30
+ Restart or open the **Google Antigravity App**, and Context Mode is active immediately.
11
31
 
12
32
  ---
13
- <img width="817" height="690" alt="Antigravity Context Mode Dashboard" src="https://github.com/user-attachments/assets/dbf6d666-58d0-48f3-bc02-9783acf3fb37" />
14
33
 
15
34
  ## The Problem: Context Window Bloat
16
35
 
17
- When an AI coding agent runs tools, standard workflows dump everything directly into your conversation history:
36
+ When an AI coding agent executes tools, standard workflows dump everything directly into your conversation context:
18
37
 
19
38
  * Running `Get-Content Logs/Editor.log` dumps **65 KB (~16,000 tokens)** into your prompt.
20
39
  * Running test suites, compiler outputs, or git diffs dumps **100+ KB** of repetitive text.
21
- * Reading large source files or documentation dumps **thousands of lines** of irrelevant boilerplate.
40
+ * Reading large files or documentation dumps **thousands of lines** of irrelevant boilerplate.
22
41
 
23
42
  ### Why this hurts:
24
- 1. **Agent Amnesia**: Important system instructions, user constraints, and earlier architectural decisions get drowned out ("lost in the middle").
25
- 2. **Slower Responses**: Model evaluation and generation times climb as the context window fills up.
26
- 3. **Burned Quota & Ceilings**: You hit model context limits and rate limits after only a few turns.
43
+ 1. **Agent Amnesia**: Important system instructions, user constraints, and earlier architectural decisions get drowned out.
44
+ 2. **Slower Responses**: Generation times climb as the context window fills up with raw text.
45
+ 3. **Burned Quota**: You hit model context ceilings and rate limits after only a few turns.
27
46
 
28
47
  ---
29
48
 
30
- ## The Solution: How Context Mode Works
49
+ ## How It Works
31
50
 
32
51
  ```text
33
- ┌────────────────────────────────────────────────────────────────────────┐
34
- │ ANTIGRAVITY AGENT │
35
- └───────────────────────────────────┬────────────────────────────────────┘
36
- │
37
- Tool Call (e.g. read large file/command)
38
- ▼
39
- ┌────────────────────────────────────────────────────────────────────────┐
40
- │ PRE-TOOL-USE LIFECYCLE HOOK GATE │
41
- │ • Blocks unbounded dumps (cat, Get-Content, git diff) │
42
- │ • Enforces 8 KB cutoff for un-paged file reads │
43
- │ • Automatically exempts binary media, documents, & prompt attachments │
44
- └───────────────────┬────────────────────────────────┬───────────────────┘
45
- │ │
46
- Under 8 KB (Safe) Over 8 KB (Blocked)
47
- │ │
48
- ▼ ▼
49
- Executes normally Redirects to Context Mode Engine:
50
- ┌───────────────────────────────────┐
51
- │ 1. Sandboxed Code Execution │
52
- │ (Thinking in Code) │
53
- │ 2. SQLite FTS5 Indexing │
54
- │ 3. BM25 + Trigram RRF Search │
55
- └───────────────────────────────────┘
56
- │
57
- ▼
58
- Returns only the filtered,
59
- relevant answer to the chat!
52
+ ┌────────────────────────────────────────────────────────┐
53
+ │ 1. Agent attempts to read a large file or command │
54
+ │ (e.g. 5,000-line build log or 40 KB source file) │
55
+ └───────────────────────────┬────────────────────────────┘
56
+ │
57
+ ▼
58
+ ┌────────────────────────────────────────────────────────┐
59
+ │ 2. Pre-Tool Lifecycle Hook Intercepts Unbounded Dumps │
60
+ │ • Files under 8 KB pass through normally │
61
+ │ • Un-paged dumps over 8 KB are safely intercepted │
62
+ │ • Images, docs, and chat attachments are exempted │
63
+ └───────────────────────────┬────────────────────────────┘
64
+ │
65
+ ▼
66
+ ┌────────────────────────────────────────────────────────┐
67
+ │ 3. Sandboxed Execution ("Thinking in Code") │
68
+ │ • Agent filters data locally using Node/Python │
69
+ │ • Indexes text into local SQLite FTS5 BM25 database │
70
+ │ • Returns only the exact answer or error to chat! │
71
+ └────────────────────────────────────────────────────────┘
60
72
  ```
61
73
 
62
- 1. **Smart Lifecycle Gating (`hooks.json`)**: Before a command or file read executes, Context Mode checks if it will cause a context flood. Applied identically to primary agents and subagents, the hook intercepts un-paged reads exceeding the active cutoff (default 8 KB) and unbounded dumps, guiding agents to query or sandbox the data instead.
63
- 2. **"Thinking in Code" (`ctx_execute`)**: Instead of reading a 5,000-line log into memory, the agent executes a concise local script (Node.js, Python, or PowerShell). The script filters the data in **50 ms** and returns *only* the specific answer or error to the conversation.
64
- 3. **Local SQLite FTS5 Storage (`ctx_search`, `ctx_index`)**: Raw outputs and indexed files are saved safely on your local disk in `~/.context-mode/context.db`. The agent uses reciprocal rank fusion search to fetch only the exact snippets it needs.
65
- 4. **Live Sidecar Dashboard**: A native side pane right inside the Antigravity App that displays real-time context savings across primary agents and subagents, lets you toggle file categories on the fly, and search indexed data with a click.
66
-
67
74
  ---
68
75
 
69
76
  ## Proven Results
70
77
 
71
- Tested live on real-world build logs, source files, and datasets in the Antigravity App:
78
+ Tested live on real-world build logs and source files in the Antigravity App:
72
79
 
73
80
  | Operation | Without Context Mode | With Context Mode | Savings |
74
81
  | :--- | :---: | :---: | :---: |
@@ -78,131 +85,53 @@ Tested live on real-world build logs, source files, and datasets in the Antigrav
78
85
 
79
86
  ---
80
87
 
81
- ## Quick Start & Installation
82
-
83
- ### Option 1: Global User Install (Recommended)
84
- Installs Context Mode for all your projects and conversations:
85
-
86
- ```bash
87
- # Clone directly into your Antigravity user plugins directory
88
- git clone https://github.com/Domush/antigravity-plugin-context-mode.git ~/.gemini/config/plugins/antigravity-plugin-context-mode
89
- ```
88
+ ## Key Features
90
89
 
91
- Restart the Antigravity App once. The plugin, hooks, and MCP tools will be active globally!
92
-
93
- ### Option 2: Project-Scoped Workspace Install
94
- If you only want Context Mode active in a specific project:
95
-
96
- ```bash
97
- # From your project root directory:
98
- mkdir -p .agents/plugins
99
- git clone https://github.com/Domush/antigravity-plugin-context-mode.git .agents/plugins/antigravity-plugin-context-mode
100
- ```
101
-
102
- ### Option 3: Via npm
103
- ```bash
104
- npm install -g antigravity-plugin-context-mode
105
- ```
106
-
107
- ---
108
-
109
- ## Live Auxiliary Sidecar Dashboard
110
-
111
- Context Mode includes a native web dashboard that opens directly in Antigravity's **Auxiliary (Side) Pane**:
112
-
113
- * **One-Click Open Pill:** Click `[Open Context Mode Dashboard](sidecar://antigravity-plugin-context-mode/dashboard/)` in chat anytime.
114
- * **Active / Paused Toggle:** Click the status pill in the top header to instantly pause protection when you intentionally need un-gated operations, and click again to re-activate.
115
- * **Dynamic Version Badge:** Automatically reflects the active plugin version in the top-right header.
116
- * **Context Saved Progress Bar:** Visual indicator displaying the exact percentage of context window preserved.
117
- * **3-Way Scope Toggle:** Seamlessly inspect telemetry at three distinct levels:
118
- * **Conversation**: Metrics strictly for the active chat; clean slate on new conversations. Subagent actions within the conversation feed directly into this view.
119
- * **Session**: Metrics aggregated across all conversations since the app restarted. Automatically resets transient overrides on app reboot.
120
- * **Lifetime**: All-time cumulative database metrics and persistent totals. Changing the cutoff in Lifetime updates the baseline defaults for all new sessions and new conversations.
121
- * **Shared Subagent Feed:** Interceptions triggered by subagents (`researcher`, `browser`, etc.) are badged by role and displayed alongside primary agent events in the same conversation feed.
122
- * **File Category Toggles:** Clean, one-click pills for grouping exemptions without reading massive lists:
123
- * **Images** (`.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, `.svg`, `.bmp`, `.ico`, `.tiff`, `.psd`) — *Enabled by default*
124
- * **Documents** (`.pdf`, `.docx`, `.doc`, `.xlsx`, `.xls`, `.pptx`, `.ppt`, `.odt`, `.rtf`) — *Enabled by default*
125
- * **3D Models** (`.blend`, `.fbx`, `.obj`, `.gltf`, `.glb`, `.stl`, `.dae`, `.3ds`, `.step`, `.iges`) — *Enabled by default*
126
- * **Music** (`.mp3`, `.wav`, `.ogg`, `.flac`, `.aac`, `.m4a`, `.wma`, `.midi`) — *Enabled by default*
127
- * **Video** (`.mp4`, `.mov`, `.avi`, `.mkv`, `.webm`, `.flv`, `.wmv`, `.m4v`) — *Enabled by default*
128
- * **Archives** (`.zip`, `.tar`, `.gz`, `.7z`, `.rar`, `.wasm`) — *Enabled by default*
129
- * **Source Code** (`.js`, `.ts`, `.py`, `.rs`, `.go`, `.java`, `.c`, `.cpp`, `.cs`, `.html`, `.css`, etc.) — *Disabled by default to protect context*
130
- * **Custom File Extensions:** Dedicated section displaying only user-added file extensions (e.g. `.csv`, `.parquet`, `.log`) with instant removal.
131
- * **Chat Attachment Exemption:** Files attached directly in chat messages (`@` mentions and drag-and-drops) always bypass size cutoffs so the agent can inspect them in full.
132
- * **Interactive Cutoff Dropdown:** Switch size cutoffs on the fly (`2 KB`, `4 KB`, `8 KB`, `16 KB`, `32 KB`, `64 KB`, or `none`). Line slice limits scale dynamically (2 KB: ≤ 50 lines, 8 KB: ≤ 200 lines, 32 KB: ≤ 800 lines).
133
- * **Interactive FTS5 Search Inspector:** Search your indexed logs and files directly from the UI to inspect what the agent has indexed.
134
- * **1-Click Session Purge:** Wipe session indexes and reset counters whenever you start a fresh task.
90
+ * 🛡️ **Automated Interception**: Blocks unbounded file dumps and commands before they bloat your context window.
91
+ * ⚡ **Thinking in Code**: Filters multi-thousand-line outputs in 50 ms via local sandboxed scripts.
92
+ * 🔍 **Local SQLite FTS5 Search**: Indexes files and logs locally on your machine with BM25 keyword matching and trigram search.
93
+ * 📊 **Built-In Sidecar Dashboard**: Real-time stats pane inside Antigravity showing tokens kept out of context.
94
+ * 🔒 **100% Local & Private**: All indexed data stays on your machine in `~/.context-mode/context.db`. Zero network calls.
95
+ * 📦 **Zero Dependencies**: Pure native Node.js (`node:sqlite`). No native builds, no `node-gyp`.
135
96
 
136
97
  ---
137
98
 
138
99
  ## Available MCP Tools
139
100
 
140
- Once installed, the following 8 tools are registered in your Antigravity App:
101
+ Once installed, Context Mode provides 8 specialized tools for your agent:
141
102
 
142
- | Tool | What It Does | Example Use Case |
143
- | :--- | :--- | :--- |
144
- | **`ctx_execute`** | Runs sandboxed Node.js, Python, or PowerShell scripts with token limits. | Filtering build errors, extracting JSON keys from large API responses. |
145
- | **`ctx_search`** | Searches SQLite FTS5 using BM25 stemming and Trigram matching. | Finding error codes, method names, or stack traces in past logs. |
146
- | **`ctx_index`** | Indexes local files, web URLs, or text into searchable chunks. | Indexing a 1,000-line documentation file or architecture spec. |
147
- | **`ctx_batch`** | Runs multiple shell commands in batch and indexes the combined output. | Running `git status`, `git log`, and `npm test` in one compact call. |
148
- | **`ctx_stats`** | Displays a formatted savings report and token metrics. | Checking how many tokens were saved during your session. |
149
- | **`ctx_resume`** | Returns recent indexed sources and state pointers. | Re-orienting the agent after context compaction. |
150
- | **`ctx_doctor`** | Checks SQLite database health, WAL mode, and active runtimes. | Verifying database integrity and platform runtimes. |
151
- | **`ctx_purge`** | Clears stored sources and events from SQLite. | Resetting session or worktree indexes. |
103
+ | Tool | What It Does |
104
+ | :--- | :--- |
105
+ | **`ctx_execute`** | Runs sandboxed Node.js, Python, or PowerShell scripts to inspect files and extract answers without context dumps. |
106
+ | **`ctx_search`** | Searches indexed logs and documentation using local SQLite FTS5 BM25 stemming. |
107
+ | **`ctx_index`** | Indexes local files or documentation into searchable chunks for the agent. |
108
+ | **`ctx_batch`** | Runs multiple terminal commands in batch and indexes the combined output. |
109
+ | **`ctx_stats`** | Displays a formatted context savings report and token metrics. |
110
+ | **`ctx_resume`** | Returns recent indexed sources and state pointers after context compactions. |
111
+ | **`ctx_doctor`** | Checks SQLite database health, WAL mode, and platform runtimes. |
112
+ | **`ctx_purge`** | Clears stored sources and events from SQLite. |
152
113
 
153
114
  ---
154
115
 
155
- ## Configuration & Environment Variables
116
+ ## Managing the Plugin
156
117
 
157
- You can customize Context Mode's cutoffs at any time using the dashboard dropdown or environment variables:
118
+ ### Enable / Disable Anytime
119
+ Open the **Google Antigravity App** &rarr; **Customizations** &rarr; **Plugins**, and toggle **Context Mode** on or off with one click.
158
120
 
159
- | Variable | Default | Description |
160
- | :--- | :---: | :--- |
161
- | `CONTEXT_MODE_MAX_READ_BYTES` | `8192` (8 KB) | Size threshold beyond which un-paged file reads are rejected. Set `0` to disable. |
162
- | `CONTEXT_MODE_MAX_LINE_RANGE` | *Dynamic* (or `200`) | Maximum allowable line slice range before pagination rejection (scales with cutoff). |
163
- | `CONTEXT_MODE_MAX_OUTPUT_BYTES` | *Dynamic* (or `16384`) | Maximum raw preview bytes returned by `ctx_execute` (defaults to 2x cutoff). |
164
- | `CONTEXT_MODE_TIMEOUT_MS` | `30000` (30s) | Execution timeout for sandboxed code snippets. |
121
+ ### Adjust Cutoffs
122
+ You can adjust the file read cutoff directly in the sidecar dashboard dropdown (`2 KB`, `4 KB`, `8 KB`, `16 KB`, `32 KB`, `64 KB`, or `none`).
165
123
 
166
- ### How to set on Windows (PowerShell):
167
- ```powershell
168
- $env:CONTEXT_MODE_MAX_READ_BYTES = "4096" # Enforce strict 4 KB cutoff
169
- ```
124
+ ### Uninstall
125
+ To remove the plugin from your system:
170
126
 
171
- ### How to set on macOS / Linux:
172
127
  ```bash
173
- export CONTEXT_MODE_MAX_READ_BYTES=4096
174
- ```
175
-
176
- ---
177
-
178
- ## Privacy & Zero Dependencies
179
-
180
- * **100% Local**: All indexed data lives on your machine in `~/.context-mode/context.db`. Zero network calls are made.
181
- * **Zero 3rd-Party Dependencies**: Built exclusively on native Node.js (`node:sqlite` / `DatabaseSync`, `child_process`, and `http`). No native C++ builds, no `node-gyp`, and no dependency security vulnerabilities.
182
- * **Safe Sandboxing**: Process execution in `ctx_execute` enforces strict execution timeouts and output caps to prevent runaway processes.
183
-
184
- ---
128
+ # Remove global plugin
129
+ npx antigravity-plugin-context-mode uninstall
185
130
 
186
- ## Running Tests
187
-
188
- Context Mode ships with a complete test suite using Node's native test runner:
189
-
190
- ```bash
191
- npm test
131
+ # Remove per-project plugin
132
+ npx antigravity-plugin-context-mode uninstall --workspace
192
133
  ```
193
134
 
194
- Verifies:
195
- * SQLite FTS5 schema initialization, chunking, Porter BM25, and Trigram search.
196
- * Reciprocal Rank Fusion (RRF) ranking.
197
- * Sandbox execution and process timeout termination.
198
- * `PreToolUse` and `SessionStart` lifecycle hook gating for primary agents and subagents.
199
- * Shared conversation dashboard linking and subagent interception event journal.
200
- * Lifetime cutoff inheritance across new sessions and new conversations.
201
- * Mathematically accurate context savings calculations without double-counting.
202
- * File category toggles and custom extension management.
203
- * Active / Paused state toggle and bypass logic.
204
- * MCP stdio JSON-RPC protocol compliance.
205
-
206
135
  ---
207
136
 
208
137
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antigravity-plugin-context-mode",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Native Antigravity plugin for context-mode: SQLite FTS5 indexing, sandboxed execution, and lifecycle hook protection against context window bloat",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -12,7 +12,7 @@
12
12
  "bugs": {
13
13
  "url": "https://github.com/Domush/antigravity-plugin-context-mode/issues"
14
14
  },
15
- "homepage": "https://github.com/Domush/antigravity-plugin-context-mode#readme",
15
+ "homepage": "https://domush.github.io/antigravity-plugin-context-mode/",
16
16
  "keywords": [
17
17
  "antigravity",
18
18
  "antigravity-plugin",
package/plugin.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "antigravity-plugin-context-mode",
3
3
  "displayName": "Context Mode",
4
4
  "description": "Context window protection for Antigravity: local SQLite FTS5 search, sandboxed execution, and lifecycle hook gating against token bloat.",
5
- "version": "1.3.0",
5
+ "version": "1.3.2",
6
6
  "author": "Phillip Webber <github@webbsense.com>",
7
7
  "repository": {
8
8
  "type": "git",
package/server.js CHANGED
@@ -13,6 +13,103 @@ try {
13
13
  if (pkg.version) pkgVersion = pkg.version;
14
14
  } catch {}
15
15
 
16
+ // Handle CLI subcommands (e.g. npx antigravity-plugin-context-mode install)
17
+ const cliArg = process.argv[2];
18
+ if (
19
+ cliArg === "install" ||
20
+ cliArg === "uninstall" ||
21
+ cliArg === "--help" ||
22
+ cliArg === "-h" ||
23
+ cliArg === "--version" ||
24
+ cliArg === "-v"
25
+ ) {
26
+ if (cliArg === "--version" || cliArg === "-v") {
27
+ console.log(`antigravity-plugin-context-mode v${pkgVersion}`);
28
+ process.exit(0);
29
+ }
30
+
31
+ if (cliArg === "--help" || cliArg === "-h") {
32
+ console.log(`
33
+ Antigravity Context Mode CLI (v${pkgVersion})
34
+
35
+ Usage:
36
+ npx antigravity-plugin-context-mode install [options] Install plugin into Google Antigravity
37
+ npx antigravity-plugin-context-mode uninstall [options] Remove installed plugin
38
+ npx antigravity-plugin-context-mode Start MCP stdio JSON-RPC server
39
+
40
+ Options:
41
+ --global, -g Install globally in ~/.gemini/config/plugins/ (default)
42
+ --workspace, -w Install in current workspace (.gemini/plugins/antigravity-plugin-context-mode)
43
+ `);
44
+ process.exit(0);
45
+ }
46
+
47
+ const isWorkspace = process.argv.includes("--workspace") || process.argv.includes("-w");
48
+ const homeDir = process.env.USERPROFILE || process.env.HOME || "";
49
+
50
+ let targetDir = "";
51
+ if (isWorkspace) {
52
+ targetDir = path.join(process.cwd(), ".gemini", "plugins", "antigravity-plugin-context-mode");
53
+ } else {
54
+ targetDir = path.join(homeDir, ".gemini", "config", "plugins", "antigravity-plugin-context-mode");
55
+ }
56
+
57
+ if (cliArg === "uninstall") {
58
+ if (fs.existsSync(targetDir)) {
59
+ fs.rmSync(targetDir, { recursive: true, force: true });
60
+ console.log(`\n✔ Antigravity Context Mode successfully removed from:`);
61
+ console.log(` ${targetDir}\n`);
62
+ } else {
63
+ console.log(`\nℹ Plugin not found at: ${targetDir}\n`);
64
+ }
65
+ process.exit(0);
66
+ }
67
+
68
+ if (cliArg === "install") {
69
+ console.log(`\n📦 Installing Antigravity Context Mode v${pkgVersion}...`);
70
+ try {
71
+ fs.mkdirSync(targetDir, { recursive: true });
72
+
73
+ const filesToCopy = [
74
+ "plugin.json",
75
+ "hooks.json",
76
+ "mcp_config.json",
77
+ "server.js",
78
+ "package.json",
79
+ "README.md",
80
+ "LICENSE",
81
+ "CHANGELOG.md"
82
+ ];
83
+
84
+ const dirsToCopy = ["lib", "hooks", "skills", "rules", "assets"];
85
+
86
+ for (const file of filesToCopy) {
87
+ const src = path.join(__dirname, file);
88
+ const dest = path.join(targetDir, file);
89
+ if (fs.existsSync(src)) {
90
+ fs.copyFileSync(src, dest);
91
+ }
92
+ }
93
+
94
+ for (const dir of dirsToCopy) {
95
+ const srcDir = path.join(__dirname, dir);
96
+ const destDir = path.join(targetDir, dir);
97
+ if (fs.existsSync(srcDir)) {
98
+ fs.cpSync(srcDir, destDir, { recursive: true });
99
+ }
100
+ }
101
+
102
+ console.log(`\n✨ Installation complete!`);
103
+ console.log(`📍 Location: ${targetDir}`);
104
+ console.log(`🚀 Restart or open the Google Antigravity App to activate Context Mode.\n`);
105
+ } catch (err) {
106
+ console.error(`\n❌ Installation failed: ${err.message}\n`);
107
+ process.exit(1);
108
+ }
109
+ process.exit(0);
110
+ }
111
+ }
112
+
16
113
  const store = new ContextModeStore();
17
114
  let currentCwd = process.cwd();
18
115
  let currentSessionId =