gravity-core 1.0.1 → 1.0.3

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 CHANGED
@@ -14,7 +14,7 @@ Gravity will:
14
14
  3. Analyze its position, styles, and visibility
15
15
  4. Return specific issues and fixes
16
16
 
17
- ## 🚀 Quick Start (2 minutes)
17
+ ## 🚀 Quick Start (5 minutes)
18
18
 
19
19
  ### 1. Install Package
20
20
 
@@ -22,21 +22,48 @@ Gravity will:
22
22
  npm install gravity-core
23
23
  ```
24
24
 
25
- ### 2. Load Chrome Extension
25
+ ### 2. Setup Extension
26
26
 
27
- 1. Go to `chrome://extensions`
28
- 2. Enable "Developer mode"
27
+ ```bash
28
+ gravity setup-extension
29
+ ```
30
+
31
+ This extracts the Chrome extension to `~/.gravity-extension`.
32
+
33
+ ### 3. Setup Native Host
34
+
35
+ ```bash
36
+ gravity setup-native-host
37
+ ```
38
+
39
+ This:
40
+ - Auto-detects your Gravity extension ID
41
+ - Asks for confirmation before modifying registry
42
+ - Sets up native messaging for Chrome
43
+ - Optionally restarts Chrome
44
+
45
+ ### 4. Load Extension in Chrome
46
+
47
+ 1. Open Chrome and go to `chrome://extensions`
48
+ 2. Enable "Developer mode" (toggle in top right)
29
49
  3. Click "Load unpacked"
30
- 4. Select the `extension/` folder from the repo
50
+ 4. Select the `~/.gravity-extension` folder
31
51
  5. ✅ Done!
32
52
 
33
- ### 3. Connect to Tab
53
+ ### 5. Test Connection
54
+
55
+ ```bash
56
+ gravity test-connection
57
+ ```
34
58
 
35
- 1. Click the Gravity extension icon
36
- 2. Click "Connect to Tab"
37
- 3. Status turns 🟢 Green
59
+ This verifies:
60
+ - Registry key exists
61
+ - Manifest is valid
62
+ - ✅ Extension ID is configured
63
+ - ✅ Native host is executable
64
+ - ✅ WebSocket connection works
38
65
 
39
- ### 4. Configure Your IDE
66
+ ### 6. Configure Your IDE
40
67
 
41
68
  **VSCode:**
42
69
  ```json
@@ -70,7 +97,7 @@ Same as VSCode
70
97
  **Warp or any IDE with MCP:**
71
98
  Add the same config to your IDE's MCP settings.
72
99
 
73
- ### 5. Start Diagnosing
100
+ ### 7. Start Diagnosing
74
101
 
75
102
  Ask your AI:
76
103
  - "Diagnose the #modal element"
@@ -111,7 +138,7 @@ Your IDE (VSCode, Cursor, Kiro, etc.)
111
138
 
112
139
  MCP Server (gravity-core)
113
140
 
114
- WebSocket Connection (port 9224)
141
+ Native Messaging Host (Windows Registry)
115
142
 
116
143
  Chrome Extension (running native bridge)
117
144
 
@@ -133,13 +160,15 @@ Browser Tab (DOM, CSS, Layout data)
133
160
 
134
161
  ### Fix Offscreen Modal
135
162
 
136
- 1. Browser: Open page with broken layout
137
- 2. Extension: Click icon "Connect to Tab" (🟢 Green)
138
- 3. IDE: Ask AI: "Diagnose the .modal element"
139
- 4. AI: Shows "Element extends 50px beyond right edge"
140
- 5. You: Add `max-width: 100%` to CSS
141
- 6. Browser: Refreshes automatically
142
- 7. AI: Diagnose again Fixed!
163
+ 1. Terminal: Run `gravity setup-extension` and `gravity setup-native-host`
164
+ 2. Chrome: Load extension from `~/.gravity-extension`
165
+ 3. Browser: Open page with broken layout
166
+ 4. Extension: Click icon → "Connect to Tab" (🟢 Green)
167
+ 5. IDE: Ask AI: "Diagnose the .modal element"
168
+ 6. AI: Shows "Element extends 50px beyond right edge"
169
+ 7. You: Add `max-width: 100%` to CSS
170
+ 8. Browser: Refreshes automatically
171
+ 9. AI: Diagnose again → ✅ Fixed!
143
172
 
144
173
  ### Debug Hidden Element
145
174
 
@@ -150,6 +179,64 @@ Browser Tab (DOM, CSS, Layout data)
150
179
  5. You: Change CSS to `display: block`
151
180
  6. AI: Diagnose again → ✅ Visible!
152
181
 
182
+ ## 🔧 CLI Commands
183
+
184
+ ### Setup Extension
185
+
186
+ Extract the Chrome extension to your home directory:
187
+
188
+ ```bash
189
+ gravity setup-extension
190
+ ```
191
+
192
+ Creates `~/.gravity-extension/` ready to load in Chrome.
193
+
194
+ ### Setup Native Host
195
+
196
+ Configure native messaging for Chrome:
197
+
198
+ ```bash
199
+ gravity setup-native-host
200
+ ```
201
+
202
+ This command:
203
+ - Auto-detects your Gravity extension ID
204
+ - Asks for confirmation before modifying registry
205
+ - Copies native host to `~/.gravity-host/`
206
+ - Patches manifest with extension ID
207
+ - Writes Windows registry entry
208
+ - Optionally restarts Chrome
209
+
210
+ ### Test Connection
211
+
212
+ Verify everything is working:
213
+
214
+ ```bash
215
+ gravity test-connection
216
+ ```
217
+
218
+ Checks:
219
+ - Registry key exists
220
+ - Manifest file is valid
221
+ - Extension ID is configured
222
+ - Native host is executable
223
+ - WebSocket connection works
224
+ - Browser handshake succeeds
225
+
226
+ ### Start MCP Server
227
+
228
+ Run the MCP server (used by your IDE):
229
+
230
+ ```bash
231
+ gravity
232
+ ```
233
+
234
+ ### Show Help
235
+
236
+ ```bash
237
+ gravity --help
238
+ ```
239
+
153
240
  ## 🔧 API Reference
154
241
 
155
242
  ### Gravity
@@ -215,27 +302,44 @@ bridge.on('error', (error) => {
215
302
 
216
303
  ## 🐛 Troubleshooting
217
304
 
218
- **"Not connected to browser"**
219
- - Make sure Chrome/Edge is open
220
- - Click extension icon → "Connect to Tab"
221
- - Status should turn green
305
+ ### "Could not find Gravity extension"
306
+
307
+ **Solution:**
308
+ 1. Run `gravity setup-extension`
309
+ 2. Open Chrome and go to `chrome://extensions`
310
+ 3. Enable "Developer mode"
311
+ 4. Click "Load unpacked"
312
+ 5. Select `~/.gravity-extension`
313
+ 6. Run `gravity setup-native-host`
222
314
 
223
- **"Extension not loaded"**
224
- - Go to `chrome://extensions`
225
- - Enable "Developer mode"
226
- - Click "Load unpacked"
227
- - Select the `extension/` folder
315
+ ### "Registry key not found"
228
316
 
229
- **"Port 9224 already in use"**
230
- - Edit extension's `background.js`
231
- - Change `WEBSOCKET_PORT` to 9225
232
- - Update IDE config with `GRAVITY_PORT: 9225`
317
+ **Solution:**
318
+ - Run `gravity setup-native-host` again
319
+ - You may need to run as Administrator
320
+ - Check that Chrome is installed in the default location
233
321
 
234
- **"Element not found"**
322
+ ### "WebSocket connection failed"
323
+
324
+ **Solution:**
325
+ - Make sure the MCP server is running: `gravity`
326
+ - Check that port 9224 is not blocked by firewall
327
+ - Try a different port: `GRAVITY_PORT=9225 gravity`
328
+
329
+ ### "Element not found"
330
+
331
+ **Solution:**
235
332
  - Check selector is correct
236
333
  - Make sure element exists in page
237
334
  - Try simpler selector: `div` instead of `#modal`
238
335
 
336
+ ### "Chrome is running" warning
337
+
338
+ **Solution:**
339
+ - The setup will ask if you want to restart Chrome
340
+ - Restart Chrome manually if you prefer
341
+ - Changes take effect after restart
342
+
239
343
  ## 📖 Documentation
240
344
 
241
345
  - [Setup Guide](./SETUP.md) - Complete setup instructions
@@ -256,6 +360,8 @@ bridge.on('error', (error) => {
256
360
  - ✅ No external API calls
257
361
  - ✅ All data stays local
258
362
  - ✅ No user data collection
363
+ - ✅ Registry changes require explicit user confirmation
364
+ - ✅ No silent installations or modifications
259
365
 
260
366
  ## 📝 License
261
367
 
@@ -267,7 +373,7 @@ Contributions welcome! Please open an issue or PR on GitHub.
267
373
 
268
374
  ## 📞 Support
269
375
 
270
- - [GitHub Issues](https://github.com/gravity/core/issues)
376
+ - [GitHub Issues](https://github.com/DharuNamikaze/Gravity-Package/issues)
271
377
  - [Documentation](https://gravity.dev)
272
378
 
273
379
  ---
@@ -276,6 +382,9 @@ Contributions welcome! Please open an issue or PR on GitHub.
276
382
 
277
383
  ```bash
278
384
  npm install gravity-core
385
+ gravity setup-extension
386
+ gravity setup-native-host
387
+ gravity test-connection
279
388
  ```
280
389
 
281
- Then load the extension and configure your IDE. Happy debugging! 🎉
390
+ Then configure your IDE and start debugging! 🎉