gravity-core 1.0.2 → 1.0.4
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/README.md +109 -38
- package/SETUP.md +193 -346
- package/dist/cli-utils.d.ts +64 -0
- package/dist/cli-utils.d.ts.map +1 -0
- package/dist/cli-utils.js +256 -0
- package/dist/cli-utils.js.map +1 -0
- package/dist/cli.d.ts +7 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +254 -252
- package/dist/cli.js.map +1 -1
- package/dist/mcp-server.d.ts +10 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +223 -0
- package/dist/mcp-server.js.map +1 -0
- package/native-host/devtools-bridge-host.bat +11 -0
- package/native-host/manifest.json +9 -0
- package/package.json +2 -4
package/SETUP.md
CHANGED
|
@@ -1,260 +1,137 @@
|
|
|
1
|
-
# Gravity
|
|
1
|
+
# Gravity Setup Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Complete step-by-step guide to set up Gravity for your IDE.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Prerequisites
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
3. Analyzes its position, styles, and visibility
|
|
11
|
-
4. Returns specific issues and fixes
|
|
7
|
+
- Node.js 16+ installed
|
|
8
|
+
- Chrome or Edge browser
|
|
9
|
+
- Administrator access (for Windows registry modification)
|
|
12
10
|
|
|
13
|
-
##
|
|
11
|
+
## Installation Steps
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
- **Chrome or Edge browser** - Already have it? Great!
|
|
17
|
-
- **Any IDE** - VSCode, Cursor, Kiro, Warp, or any tool with MCP support
|
|
18
|
-
|
|
19
|
-
## 🚀 Installation (3 Steps)
|
|
20
|
-
|
|
21
|
-
### Step 1: Install npm Package
|
|
13
|
+
### Step 1: Install the Package
|
|
22
14
|
|
|
23
15
|
```bash
|
|
24
16
|
npm install gravity-core
|
|
25
17
|
```
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
1. Clone or download the extension folder from the repo
|
|
30
|
-
2. Open Chrome → `chrome://extensions`
|
|
31
|
-
3. Enable **"Developer mode"** (top right)
|
|
32
|
-
4. Click **"Load unpacked"**
|
|
33
|
-
5. Select the `extension/` folder
|
|
34
|
-
6. ✅ Extension loaded!
|
|
35
|
-
|
|
36
|
-
### Step 3: Connect Extension to Tab
|
|
37
|
-
|
|
38
|
-
1. Open any website in Chrome/Edge
|
|
39
|
-
2. Click the **Gravity** extension icon (top right)
|
|
40
|
-
3. Click **"Connect to Tab"**
|
|
41
|
-
4. Status turns **🟢 Green** = Connected!
|
|
42
|
-
|
|
43
|
-
**The extension now runs a WebSocket server on port 9224** - the MCP server connects to it automatically!
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## 💻 Configure Your IDE
|
|
19
|
+
Or globally:
|
|
48
20
|
|
|
49
|
-
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g gravity-core
|
|
23
|
+
```
|
|
50
24
|
|
|
51
|
-
|
|
52
|
-
2. Add MCP server config:
|
|
25
|
+
### Step 2: Extract Chrome Extension
|
|
53
26
|
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
"mcpServers": {
|
|
57
|
-
"gravity": {
|
|
58
|
-
"command": "npx",
|
|
59
|
-
"args": ["gravity-core"],
|
|
60
|
-
"disabled": false
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
27
|
+
```bash
|
|
28
|
+
gravity setup-extension
|
|
64
29
|
```
|
|
65
30
|
|
|
66
|
-
|
|
67
|
-
4. Open any HTML/CSS file
|
|
68
|
-
5. Ask the AI: "Diagnose the #modal element"
|
|
31
|
+
This creates `~/.gravity-extension/` with all extension files.
|
|
69
32
|
|
|
70
|
-
|
|
33
|
+
**What it does:**
|
|
34
|
+
- Copies extension files from the package
|
|
35
|
+
- Creates the directory in your home folder
|
|
36
|
+
- Prints the path for the next step
|
|
71
37
|
|
|
72
|
-
|
|
38
|
+
### Step 3: Setup Native Host (Windows Only)
|
|
73
39
|
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
"mcpServers": {
|
|
77
|
-
"gravity": {
|
|
78
|
-
"command": "npx",
|
|
79
|
-
"args": ["gravity-core"],
|
|
80
|
-
"disabled": false
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
40
|
+
```bash
|
|
41
|
+
gravity setup-native-host
|
|
84
42
|
```
|
|
85
43
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Add to `.kiro/settings/mcp.json`:
|
|
89
|
-
|
|
90
|
-
```json
|
|
91
|
-
{
|
|
92
|
-
"mcpServers": {
|
|
93
|
-
"gravity": {
|
|
94
|
-
"command": "npx",
|
|
95
|
-
"args": ["gravity-core"],
|
|
96
|
-
"disabled": false
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
```
|
|
44
|
+
This command:
|
|
101
45
|
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
46
|
+
1. **Auto-detects extension ID**
|
|
47
|
+
- Scans Chrome's extension directory
|
|
48
|
+
- Finds the Gravity extension by name
|
|
49
|
+
- No manual ID lookup needed
|
|
106
50
|
|
|
107
|
-
|
|
51
|
+
2. **Asks for confirmation**
|
|
52
|
+
```
|
|
53
|
+
⚠️ Gravity needs to add a native-messaging registry entry. Proceed? (y/n)
|
|
54
|
+
```
|
|
55
|
+
- Type `y` to proceed
|
|
56
|
+
- Type `n` to cancel
|
|
108
57
|
|
|
109
|
-
|
|
58
|
+
3. **Copies native host files**
|
|
59
|
+
- Creates `~/.gravity-host/` directory
|
|
60
|
+
- Copies native messaging host files
|
|
110
61
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"gravity": {
|
|
115
|
-
"command": "npx",
|
|
116
|
-
"args": ["gravity-core"],
|
|
117
|
-
"disabled": false
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
```
|
|
62
|
+
4. **Patches manifest**
|
|
63
|
+
- Inserts your extension ID
|
|
64
|
+
- Updates path to native host executable
|
|
122
65
|
|
|
123
|
-
|
|
66
|
+
5. **Writes registry key**
|
|
67
|
+
- Adds entry to Windows registry
|
|
68
|
+
- Location: `HKCU\Software\Google\Chrome\NativeMessagingHosts\com.devtools.bridge`
|
|
124
69
|
|
|
125
|
-
|
|
70
|
+
6. **Optionally restarts Chrome**
|
|
71
|
+
```
|
|
72
|
+
⚠️ Chrome is currently running. Restart Chrome for changes to take effect? (y/n)
|
|
73
|
+
```
|
|
74
|
+
- Type `y` to restart Chrome
|
|
75
|
+
- Type `n` to restart manually later
|
|
126
76
|
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
"mcpServers": {
|
|
130
|
-
"gravity": {
|
|
131
|
-
"command": "npx",
|
|
132
|
-
"args": ["gravity-core"],
|
|
133
|
-
"disabled": false
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
```
|
|
77
|
+
### Step 4: Load Extension in Chrome
|
|
138
78
|
|
|
139
|
-
|
|
79
|
+
1. Open Chrome and go to `chrome://extensions`
|
|
80
|
+
2. Enable "Developer mode" (toggle in top right corner)
|
|
81
|
+
3. Click "Load unpacked"
|
|
82
|
+
4. Select the `~/.gravity-extension` folder
|
|
83
|
+
5. The Gravity extension should now appear in your extensions list
|
|
140
84
|
|
|
141
|
-
|
|
85
|
+
### Step 5: Test Connection
|
|
142
86
|
|
|
87
|
+
```bash
|
|
88
|
+
gravity test-connection
|
|
143
89
|
```
|
|
144
|
-
Your IDE (VSCode, Cursor, Kiro, etc.)
|
|
145
|
-
↓
|
|
146
|
-
MCP Server (gravity-core)
|
|
147
|
-
↓
|
|
148
|
-
WebSocket Connection (port 9224)
|
|
149
|
-
↓
|
|
150
|
-
Chrome Extension (running WebSocket server)
|
|
151
|
-
↓
|
|
152
|
-
Chrome Debugger API
|
|
153
|
-
↓
|
|
154
|
-
Browser Tab (DOM, CSS, Layout data)
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
**Flow:**
|
|
158
|
-
1. You ask AI to diagnose an element
|
|
159
|
-
2. IDE sends request to MCP server
|
|
160
|
-
3. MCP server connects to extension via WebSocket on port 9224
|
|
161
|
-
4. Extension uses Chrome Debugger API to query browser
|
|
162
|
-
5. Results flow back to your IDE
|
|
163
|
-
6. AI shows you the issues and fixes
|
|
164
90
|
|
|
165
|
-
|
|
91
|
+
This verifies everything is working:
|
|
166
92
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"severity": "high",
|
|
177
|
-
"message": "Element extends 50px beyond right edge of viewport",
|
|
178
|
-
"suggestion": "Add max-width: 100% or use overflow: hidden on parent"
|
|
179
|
-
}
|
|
180
|
-
],
|
|
181
|
-
"position": {
|
|
182
|
-
"left": 100,
|
|
183
|
-
"top": 50,
|
|
184
|
-
"width": 500,
|
|
185
|
-
"height": 300
|
|
186
|
-
},
|
|
187
|
-
"viewport": {
|
|
188
|
-
"width": 1920,
|
|
189
|
-
"height": 1080
|
|
190
|
-
}
|
|
191
|
-
}
|
|
93
|
+
```
|
|
94
|
+
✅ Registry key exists
|
|
95
|
+
✅ Manifest file exists
|
|
96
|
+
✅ Manifest valid
|
|
97
|
+
✅ Extension ID configured: chrome-extension://xxxxx/
|
|
98
|
+
✅ Native host executable found
|
|
99
|
+
✅ WebSocket connection successful
|
|
100
|
+
|
|
101
|
+
🎉 Gravity is ready! All checks passed.
|
|
192
102
|
```
|
|
193
103
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
## 🎯 Common Workflows
|
|
197
|
-
|
|
198
|
-
### Workflow 1: Fix Offscreen Element (VSCode)
|
|
199
|
-
|
|
200
|
-
1. **Browser**: Open page with broken layout
|
|
201
|
-
2. **Extension**: Click icon → "Connect to Tab" (🟢 Green)
|
|
202
|
-
3. **VSCode**: Open CSS file
|
|
203
|
-
4. **VSCode**: Ask AI: "Diagnose the .modal element"
|
|
204
|
-
5. **AI**: Shows "Element extends 50px beyond right edge"
|
|
205
|
-
6. **You**: Add `max-width: 100%` to CSS
|
|
206
|
-
7. **Browser**: Refreshes automatically
|
|
207
|
-
8. **AI**: Diagnose again → ✅ Fixed!
|
|
208
|
-
|
|
209
|
-
### Workflow 2: Debug Hidden Element (Kiro)
|
|
210
|
-
|
|
211
|
-
1. **Browser**: Open page with hidden element
|
|
212
|
-
2. **Extension**: Click icon → "Connect to Tab" (🟢 Green)
|
|
213
|
-
3. **Kiro**: Ask AI: "Why is the #button not showing?"
|
|
214
|
-
4. **AI**: "The element has display: none"
|
|
215
|
-
5. **You**: Change CSS to `display: block`
|
|
216
|
-
6. **AI**: Diagnose again → ✅ Visible!
|
|
217
|
-
|
|
218
|
-
### Workflow 3: Check Multiple Elements (Cursor)
|
|
219
|
-
|
|
220
|
-
1. **Browser**: Open page
|
|
221
|
-
2. **Extension**: Connect to tab
|
|
222
|
-
3. **Cursor**: Ask AI: "Check these elements: #modal, .button, .header"
|
|
223
|
-
4. **AI**: Shows issues for all three
|
|
224
|
-
5. **You**: Fix them one by one
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
|
-
## 🔧 Configuration
|
|
104
|
+
If any checks fail, see the Troubleshooting section below.
|
|
229
105
|
|
|
230
|
-
###
|
|
106
|
+
### Step 6: Configure Your IDE
|
|
231
107
|
|
|
232
|
-
|
|
108
|
+
#### VSCode
|
|
233
109
|
|
|
234
|
-
1.
|
|
235
|
-
|
|
236
|
-
const WEBSOCKET_PORT = 9225; // Change from 9224
|
|
237
|
-
```
|
|
110
|
+
1. Open settings: `Ctrl+Shift+P` → "Preferences: Open User Settings (JSON)"
|
|
111
|
+
2. Add to your settings:
|
|
238
112
|
|
|
239
|
-
2. Update your IDE config with environment variable:
|
|
240
113
|
```json
|
|
241
114
|
{
|
|
242
115
|
"mcpServers": {
|
|
243
116
|
"gravity": {
|
|
244
117
|
"command": "npx",
|
|
245
118
|
"args": ["gravity-core"],
|
|
246
|
-
"env": {
|
|
247
|
-
"GRAVITY_PORT": "9225"
|
|
248
|
-
},
|
|
249
119
|
"disabled": false
|
|
250
120
|
}
|
|
251
121
|
}
|
|
252
122
|
}
|
|
253
123
|
```
|
|
254
124
|
|
|
255
|
-
|
|
125
|
+
3. Restart VSCode
|
|
126
|
+
|
|
127
|
+
#### Cursor
|
|
128
|
+
|
|
129
|
+
Same as VSCode - add to your MCP settings.
|
|
256
130
|
|
|
257
|
-
|
|
131
|
+
#### Kiro
|
|
132
|
+
|
|
133
|
+
1. Open Kiro settings
|
|
134
|
+
2. Add to MCP configuration:
|
|
258
135
|
|
|
259
136
|
```json
|
|
260
137
|
{
|
|
@@ -262,197 +139,167 @@ In your IDE config:
|
|
|
262
139
|
"gravity": {
|
|
263
140
|
"command": "npx",
|
|
264
141
|
"args": ["gravity-core"],
|
|
265
|
-
"env": {
|
|
266
|
-
"GRAVITY_TIMEOUT": "20000"
|
|
267
|
-
},
|
|
268
142
|
"disabled": false
|
|
269
143
|
}
|
|
270
144
|
}
|
|
271
145
|
}
|
|
272
146
|
```
|
|
273
147
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
## 🐛 Troubleshooting
|
|
148
|
+
#### Other IDEs with MCP Support
|
|
277
149
|
|
|
278
|
-
|
|
150
|
+
Add the same configuration to your IDE's MCP settings file.
|
|
279
151
|
|
|
280
|
-
|
|
152
|
+
### Step 7: Start Using Gravity
|
|
281
153
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
154
|
+
1. Open a web page in Chrome
|
|
155
|
+
2. Click the Gravity extension icon in your toolbar
|
|
156
|
+
3. Click "Connect to Tab"
|
|
157
|
+
4. Status should turn green
|
|
158
|
+
5. In your IDE, ask your AI assistant:
|
|
159
|
+
- "Diagnose the #modal element"
|
|
160
|
+
- "Why is the .button not showing?"
|
|
161
|
+
- "Check if the browser is connected"
|
|
287
162
|
|
|
288
|
-
|
|
163
|
+
## File Locations
|
|
289
164
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
**Solution**:
|
|
293
|
-
1. Go to `chrome://extensions`
|
|
294
|
-
2. Enable "Developer mode" (top right)
|
|
295
|
-
3. Click "Load unpacked"
|
|
296
|
-
4. Select the `extension/` folder
|
|
297
|
-
5. Refresh the page
|
|
298
|
-
|
|
299
|
-
### "Port 9224 already in use"
|
|
165
|
+
Gravity stores files in your home directory:
|
|
300
166
|
|
|
301
|
-
|
|
167
|
+
- `~/.gravity-extension/` - Chrome extension files
|
|
168
|
+
- `~/.gravity-host/` - Native messaging host files
|
|
169
|
+
- `~/.gravity-host/manifest.json` - Native host configuration
|
|
302
170
|
|
|
303
|
-
|
|
304
|
-
1. Edit extension's `background.js`
|
|
305
|
-
2. Change `WEBSOCKET_PORT` to 9225
|
|
306
|
-
3. Update IDE config with `DEVTOOLS_BRIDGE_PORT: 9225`
|
|
307
|
-
4. Reload extension
|
|
171
|
+
## Environment Variables
|
|
308
172
|
|
|
309
|
-
|
|
173
|
+
You can customize Gravity's behavior with environment variables:
|
|
310
174
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
1. Check selector is correct
|
|
315
|
-
2. Make sure element exists in page
|
|
316
|
-
3. Try simpler selector: `div` instead of `#modal`
|
|
317
|
-
4. Check browser console for errors
|
|
318
|
-
|
|
319
|
-
### "Connection timeout"
|
|
320
|
-
|
|
321
|
-
**Problem**: Error "Connection timeout"
|
|
322
|
-
|
|
323
|
-
**Solution**:
|
|
324
|
-
1. Make sure extension is connected (green status)
|
|
325
|
-
2. Check firewall isn't blocking port 9224
|
|
326
|
-
3. Restart browser
|
|
327
|
-
4. Reload extension
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## 📚 API Reference
|
|
175
|
+
```bash
|
|
176
|
+
# Change WebSocket port (default: 9224)
|
|
177
|
+
GRAVITY_PORT=9225 gravity
|
|
332
178
|
|
|
333
|
-
|
|
179
|
+
# Change connection timeout (default: 10000ms)
|
|
180
|
+
GRAVITY_TIMEOUT=20000 gravity
|
|
181
|
+
```
|
|
334
182
|
|
|
335
|
-
|
|
336
|
-
import { Gravity } from 'gravity-core';
|
|
183
|
+
## Troubleshooting
|
|
337
184
|
|
|
338
|
-
|
|
339
|
-
```
|
|
185
|
+
### "Could not find Gravity extension"
|
|
340
186
|
|
|
341
|
-
|
|
187
|
+
**Problem:** `gravity setup-native-host` can't find your extension.
|
|
342
188
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
autoReconnect?: boolean; // Default: true
|
|
348
|
-
}
|
|
349
|
-
```
|
|
189
|
+
**Solutions:**
|
|
190
|
+
1. Make sure you ran `gravity setup-extension` first
|
|
191
|
+
2. Load the extension in Chrome (`chrome://extensions` → "Load unpacked")
|
|
192
|
+
3. Try running `gravity setup-native-host` again
|
|
350
193
|
|
|
351
|
-
|
|
194
|
+
### "Failed to write registry key"
|
|
352
195
|
|
|
353
|
-
|
|
196
|
+
**Problem:** Registry modification failed.
|
|
354
197
|
|
|
355
|
-
|
|
198
|
+
**Solutions:**
|
|
199
|
+
1. Run Command Prompt as Administrator
|
|
200
|
+
2. Run `gravity setup-native-host` again
|
|
201
|
+
3. Check that Chrome is installed in the default location
|
|
202
|
+
4. Verify you have permission to modify `HKCU\Software\Google\Chrome`
|
|
356
203
|
|
|
357
|
-
|
|
358
|
-
await bridge.connectBrowser();
|
|
359
|
-
```
|
|
204
|
+
### "Registry key not found" (test-connection)
|
|
360
205
|
|
|
361
|
-
|
|
206
|
+
**Problem:** Registry key doesn't exist after setup.
|
|
362
207
|
|
|
363
|
-
|
|
208
|
+
**Solutions:**
|
|
209
|
+
1. Run `gravity setup-native-host` again
|
|
210
|
+
2. Make sure you confirmed the registry modification
|
|
211
|
+
3. Check registry manually:
|
|
212
|
+
```
|
|
213
|
+
reg query "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.devtools.bridge"
|
|
214
|
+
```
|
|
364
215
|
|
|
365
|
-
|
|
366
|
-
await bridge.disconnectBrowser();
|
|
367
|
-
```
|
|
216
|
+
### "WebSocket connection failed" (test-connection)
|
|
368
217
|
|
|
369
|
-
|
|
218
|
+
**Problem:** Can't connect to the MCP server.
|
|
370
219
|
|
|
371
|
-
|
|
220
|
+
**Solutions:**
|
|
221
|
+
1. Start the MCP server: `gravity`
|
|
222
|
+
2. Check port 9224 is not blocked by firewall
|
|
223
|
+
3. Try a different port: `GRAVITY_PORT=9225 gravity`
|
|
224
|
+
4. Check that the extension is loaded and connected
|
|
372
225
|
|
|
373
|
-
|
|
374
|
-
if (bridge.isConnected()) {
|
|
375
|
-
console.log('Connected!');
|
|
376
|
-
}
|
|
377
|
-
```
|
|
226
|
+
### "Extension not loaded" in Chrome
|
|
378
227
|
|
|
379
|
-
|
|
228
|
+
**Problem:** Extension doesn't appear in `chrome://extensions`.
|
|
380
229
|
|
|
381
|
-
|
|
230
|
+
**Solutions:**
|
|
231
|
+
1. Make sure you ran `gravity setup-extension`
|
|
232
|
+
2. Go to `chrome://extensions`
|
|
233
|
+
3. Enable "Developer mode" (toggle in top right)
|
|
234
|
+
4. Click "Load unpacked"
|
|
235
|
+
5. Select `~/.gravity-extension` folder
|
|
236
|
+
6. Refresh the page
|
|
382
237
|
|
|
383
|
-
|
|
384
|
-
const result = await bridge.diagnoseLayout('#modal');
|
|
385
|
-
console.log(result.issues);
|
|
386
|
-
```
|
|
238
|
+
### "Element not found" in diagnostics
|
|
387
239
|
|
|
388
|
-
|
|
240
|
+
**Problem:** Gravity can't find the element you're asking about.
|
|
389
241
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
242
|
+
**Solutions:**
|
|
243
|
+
1. Check the CSS selector is correct
|
|
244
|
+
2. Make sure the element exists on the page
|
|
245
|
+
3. Try a simpler selector (e.g., `div` instead of `#modal`)
|
|
246
|
+
4. Make sure the extension is connected (green status)
|
|
394
247
|
|
|
395
|
-
|
|
396
|
-
console.log('Disconnected from browser');
|
|
397
|
-
});
|
|
248
|
+
### Chrome keeps asking to restart
|
|
398
249
|
|
|
399
|
-
|
|
400
|
-
console.error('Error:', error);
|
|
401
|
-
});
|
|
402
|
-
```
|
|
250
|
+
**Problem:** Chrome needs to restart for changes to take effect.
|
|
403
251
|
|
|
404
|
-
|
|
252
|
+
**Solutions:**
|
|
253
|
+
1. Close Chrome completely
|
|
254
|
+
2. Restart Chrome manually
|
|
255
|
+
3. Or answer `y` when prompted during setup
|
|
405
256
|
|
|
406
|
-
|
|
257
|
+
### "Port 9224 already in use"
|
|
407
258
|
|
|
408
|
-
|
|
259
|
+
**Problem:** Another application is using port 9224.
|
|
409
260
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
| `offscreen-top` | 🔴 High | Element extends beyond top edge |
|
|
415
|
-
| `offscreen-bottom` | 🟡 Medium | Element extends beyond bottom edge |
|
|
416
|
-
| `hidden-display` | 🔴 High | `display: none` |
|
|
417
|
-
| `hidden-visibility` | 🔴 High | `visibility: hidden` |
|
|
418
|
-
| `hidden-opacity` | 🔴 High | `opacity: 0` |
|
|
419
|
-
| `low-opacity` | 🟡 Medium | `opacity < 0.1` |
|
|
420
|
-
| `modal-no-zindex` | 🟡 Medium | Positioned element without z-index |
|
|
421
|
-
| `modal-low-zindex` | 🟢 Low | `z-index < 100` |
|
|
422
|
-
| `overflow-hidden` | 🟢 Low | May clip content |
|
|
261
|
+
**Solutions:**
|
|
262
|
+
1. Use a different port: `GRAVITY_PORT=9225 gravity`
|
|
263
|
+
2. Update your IDE config to use the new port
|
|
264
|
+
3. Or stop the other application using port 9224
|
|
423
265
|
|
|
424
|
-
|
|
266
|
+
## Uninstalling
|
|
425
267
|
|
|
426
|
-
|
|
268
|
+
To remove Gravity:
|
|
427
269
|
|
|
428
|
-
1.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
5. **Start diagnosing**: Ask your AI to diagnose elements!
|
|
270
|
+
1. Remove the npm package:
|
|
271
|
+
```bash
|
|
272
|
+
npm uninstall gravity-core
|
|
273
|
+
```
|
|
433
274
|
|
|
434
|
-
|
|
275
|
+
2. Remove the extension from Chrome:
|
|
276
|
+
- Go to `chrome://extensions`
|
|
277
|
+
- Find Gravity and click "Remove"
|
|
435
278
|
|
|
436
|
-
|
|
279
|
+
3. Delete the local files (optional):
|
|
280
|
+
```bash
|
|
281
|
+
rm -r ~/.gravity-extension
|
|
282
|
+
rm -r ~/.gravity-host
|
|
283
|
+
```
|
|
437
284
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
285
|
+
4. Remove registry entry (optional, Windows):
|
|
286
|
+
```
|
|
287
|
+
reg delete "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.devtools.bridge" /f
|
|
288
|
+
```
|
|
441
289
|
|
|
442
|
-
|
|
290
|
+
## Getting Help
|
|
443
291
|
|
|
444
|
-
|
|
292
|
+
- Check the [README](./README.md) for quick start
|
|
293
|
+
- Review [Architecture](./ARCHITECTURE.md) for technical details
|
|
294
|
+
- Open an issue on [GitHub](https://github.com/DharuNamikaze/Gravity-Package/issues)
|
|
445
295
|
|
|
446
|
-
|
|
296
|
+
## Next Steps
|
|
447
297
|
|
|
448
|
-
|
|
449
|
-
npm install gravity-core
|
|
450
|
-
```
|
|
298
|
+
Once Gravity is set up:
|
|
451
299
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
4. Ask your AI to diagnose elements!
|
|
300
|
+
1. **Configure your IDE** - Add MCP server configuration
|
|
301
|
+
2. **Load the extension** - Go to `chrome://extensions` and load unpacked
|
|
302
|
+
3. **Connect to a tab** - Click extension icon and "Connect to Tab"
|
|
303
|
+
4. **Start diagnosing** - Ask your AI about layout issues
|
|
457
304
|
|
|
458
|
-
Happy debugging!
|
|
305
|
+
Happy debugging! 🎉
|