@githumbi/grabby 0.1.0 → 0.1.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 +12 -0
- package/README.md +157 -70
- package/dist/chunk-6CBIOKZV.cjs.map +1 -1
- package/dist/cli/index.js +36 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/live/index.cjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @githumbi/grabby
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 561ab50: The CLI's help text and hints now say `npx @githumbi/grabby …` instead of `npx grabby …`. On npm, `grabby` is an unrelated package, so the short form only worked once Grabby was installed in the project.
|
|
8
|
+
|
|
9
|
+
## 0.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 4742695: Everything the CLI generates is now pinned to an exact version: the `.mcp.json` entry from `grabby add mcp` and `grabby pull` run one specific `@githumbi/grabby-server` release instead of any `0.x`, and the script tag printed by `grabby init` uses this exact version with Subresource Integrity hashes for the loader and the full build. Re-run `npx grabby add mcp` after upgrading to move the pin.
|
|
14
|
+
|
|
3
15
|
## 0.1.0
|
|
4
16
|
|
|
5
17
|
First release as Grabby (formerly angular-grab).
|
package/README.md
CHANGED
|
@@ -2,50 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
**Point at any part of your UI, say what should change, and hand it to your AI coding agent.**
|
|
4
4
|
|
|
5
|
+
<p align="center"><img src="https://raw.githubusercontent.com/githumbi/grabby/main/docs/images/dev-hover.png" alt="Hovering a button in selection mode: Grabby labels it "button .btn in PlanCard, src/PlanCard.tsx:15"" width="820"></p>
|
|
6
|
+
|
|
5
7
|
Grabby adds a small toolbar to your app. Click an element, type a comment, and Grabby records where that element lives in your code (component, `file:line`), what it is (a button, a form field, a card…), the few styles that matter, and a screenshot. Collect as many comments as you like, then **Copy all** and paste into Claude, Cursor, Copilot or ChatGPT, or let your agent read them directly over MCP.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Two ways to use it
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
| | **Developer mode** | **Live feedback** |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Who comments | You (and your team) while building | Clients, testers, stakeholders |
|
|
14
|
+
| Where | Your local dev server | Your deployed site (production or staging) |
|
|
15
|
+
| What visitors see | Nothing: it's left out of production builds | Nothing, unless they open your feedback link |
|
|
16
|
+
| Where comments go | Your browser, then **Copy all** or your agent (MCP) | A small collector you host, then `pull` or MCP |
|
|
17
|
+
| Setup | [Install the package](#developer-mode) | [Run a collector and add one script tag](#live-feedback-on-your-deployed-site) |
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
1. Highlight the Pro plan button
|
|
15
|
-
- `<button class="btn">Choose Pro</button>` (action) line 15
|
|
16
|
-
- styles: bg #2563eb · color #fff · weight 600 · padding 10px 14px · radius 8px
|
|
17
|
-
- inside: App (App.tsx:11)
|
|
18
|
-
2. Stack the cards vertically on mobile
|
|
19
|
-
- `<article class="card">(4 elements)</article>` (container) line 9
|
|
20
|
-
- heading: Starter · contains: heading, p, list, button · size: 225×234
|
|
21
|
-
- layout: padding 20px · bg #fff · radius 12px · border 1px solid #e2e8f0
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
That's the whole export: no page dumps, around 150–300 tokens per comment.
|
|
19
|
+
You can use both: developer mode day to day, live feedback when someone else needs to review.
|
|
25
20
|
|
|
26
|
-
- [
|
|
27
|
-
- [
|
|
21
|
+
- [Developer mode](#developer-mode)
|
|
22
|
+
- [Live feedback on your deployed site](#live-feedback-on-your-deployed-site)
|
|
28
23
|
- [What gets captured](#what-gets-captured)
|
|
29
|
-
- [Feedback on a live site](#feedback-on-a-live-site)
|
|
30
24
|
- [Connect your AI agent](#connect-your-ai-agent)
|
|
31
25
|
- [Framework support](#framework-support)
|
|
32
26
|
- [Configuration](#configuration)
|
|
33
27
|
- [Security and privacy](#security-and-privacy)
|
|
34
28
|
|
|
35
|
-
##
|
|
29
|
+
## Developer mode
|
|
30
|
+
|
|
31
|
+
### 1. Install
|
|
32
|
+
|
|
33
|
+
You need Node 20 or newer. In your project folder, run:
|
|
36
34
|
|
|
37
35
|
```bash
|
|
38
|
-
npx grabby init
|
|
36
|
+
npx @githumbi/grabby init
|
|
39
37
|
```
|
|
40
38
|
|
|
41
|
-
`init` detects your framework, bundler and package manager, shows exactly which files it will change, and asks before touching anything.
|
|
39
|
+
`init` detects your framework, bundler and package manager, shows exactly which files it will change, and asks before touching anything. Add `--dry-run` to only see the plan.
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
Prefer to set it up by hand? Install the package as a dev dependency:
|
|
44
42
|
|
|
45
43
|
```bash
|
|
46
|
-
pnpm add -D @githumbi/grabby
|
|
44
|
+
npm install -D @githumbi/grabby # or: pnpm add -D @githumbi/grabby · yarn add -D @githumbi/grabby
|
|
47
45
|
```
|
|
48
46
|
|
|
47
|
+
then follow the steps for your stack:
|
|
48
|
+
|
|
49
|
+
<details>
|
|
50
|
+
<summary><strong>React, Vue, Solid, Preact (Vite)</strong></summary>
|
|
51
|
+
|
|
49
52
|
```ts
|
|
50
53
|
// vite.config.ts
|
|
51
54
|
import grabby from '@githumbi/grabby/plugin';
|
|
@@ -63,10 +66,22 @@ if (import.meta.env.DEV) initGrabby();
|
|
|
63
66
|
```
|
|
64
67
|
|
|
65
68
|
The plugin adds `file:line:col` to every element in development only. Production builds contain neither the stamps nor Grabby. Using webpack, Rspack, Rollup or esbuild? Use `grabby.webpack()`, `grabby.rspack()`, and so on.
|
|
69
|
+
</details>
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
<details>
|
|
72
|
+
<summary><strong>Svelte / SvelteKit</strong></summary>
|
|
73
|
+
|
|
74
|
+
No plugin needed, since Svelte's dev build already records locations. Just call `initGrabby()` in development:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { initGrabby } from '@githumbi/grabby';
|
|
78
|
+
|
|
79
|
+
if (import.meta.env.DEV) initGrabby();
|
|
80
|
+
```
|
|
81
|
+
</details>
|
|
68
82
|
|
|
69
|
-
|
|
83
|
+
<details>
|
|
84
|
+
<summary><strong>Angular (17+)</strong></summary>
|
|
70
85
|
|
|
71
86
|
```ts
|
|
72
87
|
// app.config.ts
|
|
@@ -77,9 +92,11 @@ export const appConfig: ApplicationConfig = {
|
|
|
77
92
|
};
|
|
78
93
|
```
|
|
79
94
|
|
|
80
|
-
In `angular.json`, swap the builders to `@githumbi/grabby:application` and `@githumbi/grabby:dev-server`. `npx grabby init` does both.
|
|
95
|
+
In `angular.json`, swap the builders to `@githumbi/grabby:application` and `@githumbi/grabby:dev-server`. `npx @githumbi/grabby init` does both.
|
|
96
|
+
</details>
|
|
81
97
|
|
|
82
|
-
|
|
98
|
+
<details>
|
|
99
|
+
<summary><strong>Next.js</strong></summary>
|
|
83
100
|
|
|
84
101
|
```js
|
|
85
102
|
// next.config.js
|
|
@@ -94,22 +111,54 @@ useEffect(() => {
|
|
|
94
111
|
if (process.env.NODE_ENV === 'development') import('@githumbi/grabby').then((g) => g.initGrabby());
|
|
95
112
|
}, []);
|
|
96
113
|
```
|
|
114
|
+
</details>
|
|
97
115
|
|
|
98
|
-
|
|
116
|
+
<details>
|
|
117
|
+
<summary><strong>Any site, no build step</strong></summary>
|
|
99
118
|
|
|
100
119
|
```html
|
|
101
|
-
<script src="https://cdn.jsdelivr.net/npm/@githumbi/grabby@0.1.
|
|
120
|
+
<script src="https://cdn.jsdelivr.net/npm/@githumbi/grabby@0.1.1/dist/grabby.global.js" defer></script>
|
|
102
121
|
```
|
|
103
122
|
|
|
104
|
-
|
|
123
|
+
Use an exact version, as above. Running `npx @githumbi/grabby init --dry-run` in an empty folder prints this tag with an `integrity` hash, so a tampered CDN copy won't run.
|
|
124
|
+
</details>
|
|
125
|
+
|
|
126
|
+
Start your dev server as usual. The Grabby toolbar appears the first time you press the shortcut.
|
|
127
|
+
|
|
128
|
+
### 2. Leave comments
|
|
129
|
+
|
|
130
|
+
1. Press **Option+G** (Mac) or **Alt+G** (Windows, Linux), or click the hand icon, to enter selection mode.
|
|
131
|
+
2. Hover: every element shows its component and source file, like the picture at the top. Click the one you want to change. Clicking an icon inside a button selects the button; hold **Shift** to pick the exact inner element.
|
|
132
|
+
3. Type what should change and press **Enter**. Grabby saves it with a screenshot.
|
|
133
|
+
|
|
134
|
+
<p align="center"><img src="https://raw.githubusercontent.com/githumbi/grabby/main/docs/images/dev-comment.png" alt="The comment box open next to the Choose Pro button, with a comment typed in" width="820"></p>
|
|
135
|
+
|
|
136
|
+
4. Keep going. The badge on the clock icon counts your comments, and the list shows them with thumbnails, their kind and file. Click one to edit it.
|
|
137
|
+
|
|
138
|
+
<p align="center"><img src="https://raw.githubusercontent.com/githumbi/grabby/main/docs/images/dev-comments.png" alt="The comments list with two comments, each with a thumbnail, its kind (action, field) and source file" width="820"></p>
|
|
139
|
+
|
|
140
|
+
### 3. Hand them to your agent
|
|
141
|
+
|
|
142
|
+
**Copy all** opens a preview of exactly what your agent will get. Pick a detail level, edit the text if you like, then **Copy & clear** (with Undo, just in case) or **Copy, keep comments**, and paste it into your agent.
|
|
143
|
+
|
|
144
|
+
<p align="center"><img src="https://raw.githubusercontent.com/githumbi/grabby/main/docs/images/dev-copy-all.png" alt="The Copy all preview: Compact, Standard and Detailed levels, the export text and a token estimate" width="820"></p>
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
# UI feedback · 2 comments
|
|
148
|
+
localhost:5173 · React · page /pricing · 1440×900 · 2026-09-26
|
|
149
|
+
|
|
150
|
+
## src/components/PlanCard.tsx · PlanCard
|
|
151
|
+
1. Highlight the Pro plan button
|
|
152
|
+
- `<button class="btn">Choose Pro</button>` (action) line 15
|
|
153
|
+
- styles: bg #2563eb · color #fff · weight 600 · padding 10px 14px · radius 8px
|
|
154
|
+
- inside: App (App.tsx:11)
|
|
155
|
+
2. Stack the cards vertically on mobile
|
|
156
|
+
- `<article class="card">(4 elements)</article>` (container) line 9
|
|
157
|
+
- heading: Starter · contains: heading, p, list, button · size: 225×234
|
|
158
|
+
- layout: padding 20px · bg #fff · radius 12px · border 1px solid #e2e8f0
|
|
159
|
+
```
|
|
105
160
|
|
|
106
|
-
|
|
107
|
-
2. Hover to see each element's component and file. Click one. Clicking an icon inside a button selects the button; hold **Shift** to pick the exact inner element.
|
|
108
|
-
3. Type what should change and press **Enter**. Grabby saves it with a screenshot. Nothing is copied yet.
|
|
109
|
-
4. Keep going. The badge counts your comments; the list shows them with thumbnails. Click one to edit it.
|
|
110
|
-
5. **Copy all** opens a preview. Choose a detail level, edit the text if you like, then:
|
|
111
|
-
- **Copy & clear**: copy, and start fresh next time (with Undo, in case).
|
|
112
|
-
- **Copy, keep comments**: copy and keep them.
|
|
161
|
+
That's the whole export: no page dumps, around 150–300 tokens per comment. To skip copy and paste, let your agent read comments directly: see [Connect your AI agent](#connect-your-ai-agent).
|
|
113
162
|
|
|
114
163
|
| Key | |
|
|
115
164
|
|---|---|
|
|
@@ -119,43 +168,35 @@ useEffect(() => {
|
|
|
119
168
|
| Esc | Cancel, close the panel, or leave selection mode |
|
|
120
169
|
| ⌘/Ctrl+Enter | Copy & clear, in the Copy dialog |
|
|
121
170
|
|
|
122
|
-
##
|
|
171
|
+
## Live feedback on your deployed site
|
|
123
172
|
|
|
124
|
-
|
|
173
|
+
Collect comments from clients, stakeholders or testers on your real site. Ordinary visitors see nothing and download almost nothing (a loader under 500 bytes). Reviewers open a feedback link, and every comment arrives tagged with who left it.
|
|
125
174
|
|
|
126
|
-
|
|
127
|
-
|---|---|
|
|
128
|
-
| **Action**: button, link, tab | label, href path, state (disabled, expanded, selected), custom styles |
|
|
129
|
-
| **Form field** | label, type, placeholder, required/invalid. **Never the value.** |
|
|
130
|
-
| **Text** | text (up to 120 chars), font size, weight, colour, line height |
|
|
131
|
-
| **Media** | alt text (or that it's missing), file name, rendered vs natural size |
|
|
132
|
-
| **Container / card** | heading, a summary of what's inside ("heading, 3× PlanCard, button"), layout styles |
|
|
133
|
-
| **Page section** | page title, viewport, regions and components on the page. No HTML. |
|
|
175
|
+
You'll set up two things: a small **collector** that receives comments, and one **script tag** on your site.
|
|
134
176
|
|
|
135
|
-
|
|
177
|
+
### 1. Run a collector
|
|
136
178
|
|
|
137
|
-
The
|
|
179
|
+
The collector is a small Node server with no database and no native dependencies. It runs anywhere Node 20 or Docker does: your own server, Fly.io, Render, Railway…
|
|
138
180
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
181
|
+
```bash
|
|
182
|
+
npx -y @githumbi/grabby-server@0.1.0 init --origin https://your-site.com
|
|
183
|
+
npx -y @githumbi/grabby-server@0.1.0 start --public
|
|
184
|
+
```
|
|
142
185
|
|
|
143
|
-
|
|
186
|
+
`init` prints two values. Keep them:
|
|
144
187
|
|
|
145
|
-
|
|
188
|
+
- a **project key** (`pk_…`): public, it goes into your site;
|
|
189
|
+
- an **admin token** (`sk_…`): secret, only for you and your agent.
|
|
146
190
|
|
|
147
|
-
|
|
148
|
-
npx @githumbi/grabby-server init --origin https://your-site.com
|
|
149
|
-
npx @githumbi/grabby-server start --public
|
|
150
|
-
```
|
|
191
|
+
Put the collector behind HTTPS (for example `https://feedback.your-site.com`). Deployment guides for Docker, Fly.io, Render and Railway are in [packages/server](packages/server/README.md).
|
|
151
192
|
|
|
152
|
-
|
|
193
|
+
### 2. Add Grabby to your site
|
|
153
194
|
|
|
154
|
-
|
|
195
|
+
Add this before `</body>`:
|
|
155
196
|
|
|
156
197
|
```html
|
|
157
198
|
<script
|
|
158
|
-
src="https://cdn.jsdelivr.net/npm/@githumbi/grabby@0.1.
|
|
199
|
+
src="https://cdn.jsdelivr.net/npm/@githumbi/grabby@0.1.1/dist/loader.global.js"
|
|
159
200
|
data-mode="live"
|
|
160
201
|
data-server="https://feedback.your-site.com"
|
|
161
202
|
data-project-key="pk_…"
|
|
@@ -163,9 +204,9 @@ npx @githumbi/grabby-server start --public
|
|
|
163
204
|
></script>
|
|
164
205
|
```
|
|
165
206
|
|
|
166
|
-
|
|
207
|
+
For production, also add integrity hashes so a tampered CDN copy can't run. Run `npx @githumbi/grabby init --live --server https://feedback.your-site.com --key pk_… --dry-run` in an empty folder, and it prints this tag with `integrity` (for the loader) and `data-integrity` (for the full build it fetches) filled in. Always use an exact version, never a range like `@0.1`.
|
|
167
208
|
|
|
168
|
-
|
|
209
|
+
Using a bundler instead? Install `@githumbi/grabby` as a normal dependency and call:
|
|
169
210
|
|
|
170
211
|
```ts
|
|
171
212
|
import { initGrabbyLive } from '@githumbi/grabby/live';
|
|
@@ -173,22 +214,67 @@ import { initGrabbyLive } from '@githumbi/grabby/live';
|
|
|
173
214
|
initGrabbyLive({ server: 'https://feedback.your-site.com', projectKey: 'pk_…' });
|
|
174
215
|
```
|
|
175
216
|
|
|
176
|
-
|
|
217
|
+
### 3. Share the feedback link
|
|
218
|
+
|
|
219
|
+
Send reviewers your page with `?grabby=` and your project key:
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
https://your-site.com/?grabby=pk_…
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
They get a **Comment** button and a short three-step tip. No account or install needed.
|
|
226
|
+
|
|
227
|
+
<p align="center"><img src="https://raw.githubusercontent.com/githumbi/grabby/main/docs/images/live-welcome.png" alt="A live site opened with the feedback link: the tip explains Comment, click, type, and the toolbar shows a Comment button" width="820"></p>
|
|
228
|
+
|
|
229
|
+
After their first comment, Grabby asks who it's from: a name, or **Post anonymously**. The choice is remembered, and anonymous reviewers still get a stable id, so you can tell "Anonymous 3f9a" from "Anonymous b21c". If your app already knows who's signed in, skip the question with `grabby.identify({ id, name })`.
|
|
177
230
|
|
|
178
|
-
|
|
231
|
+
<p align="center"><img src="https://raw.githubusercontent.com/githumbi/grabby/main/docs/images/live-identity.png" alt="After a comment, Grabby asks: Thanks! Who is this from? with a name field, Post anonymously and Post" width="820"></p>
|
|
179
232
|
|
|
180
|
-
|
|
233
|
+
Each comment is sent as soon as it's saved. It's kept in the browser first and retried until it reaches your collector, so a bad connection doesn't lose it, and closing the tab with a half-typed or unsent comment brings up the browser's "Leave site?" prompt. The toolbar shows how many were sent. When reviewers are done, **Finish review** shows what reached you; **Done** clears their list for another round.
|
|
234
|
+
|
|
235
|
+
<p align="center"><img src="https://raw.githubusercontent.com/githumbi/grabby/main/docs/images/live-finish.png" alt="The Finish review summary: Your comment was sent to the team, with Keep reviewing and Done; the toolbar shows 1 sent" width="820"></p>
|
|
236
|
+
|
|
237
|
+
### 4. Pull the feedback into your agent
|
|
181
238
|
|
|
182
239
|
```bash
|
|
183
|
-
npx @githumbi/grabby-server pull --server https://feedback.your-site.com --token sk_…
|
|
240
|
+
npx -y @githumbi/grabby-server@0.1.0 pull --server https://feedback.your-site.com --token sk_…
|
|
184
241
|
```
|
|
185
242
|
|
|
186
|
-
This prints every open comment, grouped by file and labelled by author, and saves the screenshots to `./.grabby/screenshots/` where your agent can open them
|
|
243
|
+
This prints every open comment, grouped by file and labelled by author, and saves the screenshots to `./.grabby/screenshots/` where your agent can open them:
|
|
244
|
+
|
|
245
|
+
```text
|
|
246
|
+
3. Make this button green so it matches our brand
|
|
247
|
+
- `<button class="cta">Start free trial</button>` (action) Hero
|
|
248
|
+
- styles: bg #111827 · color #fff · size 16px · weight 600 · padding 14px 22px · radius 10px
|
|
249
|
+
- screenshot: .grabby/screenshots/9c1f….webp
|
|
250
|
+
- by Amina (client)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
The comments are then marked resolved, so the next pull shows only new feedback. Use `--keep` to leave them open or `--delete` to remove them. Or give your agent the collector over MCP (next section) and ask it to "fix the open Grabby comments".
|
|
254
|
+
|
|
255
|
+
## What gets captured
|
|
256
|
+
|
|
257
|
+
Grabby looks at *what kind* of element you clicked and keeps only what matters for it:
|
|
258
|
+
|
|
259
|
+
| Kind | Captured |
|
|
260
|
+
|---|---|
|
|
261
|
+
| **Action**: button, link, tab | label, href path, state (disabled, expanded, selected), custom styles |
|
|
262
|
+
| **Form field** | label, type, placeholder, required/invalid. **Never the value.** |
|
|
263
|
+
| **Text** | text (up to 120 chars), font size, weight, colour, line height |
|
|
264
|
+
| **Media** | alt text (or that it's missing), file name, rendered vs natural size |
|
|
265
|
+
| **Container / card** | heading, a summary of what's inside ("heading, 3× PlanCard, button"), layout styles |
|
|
266
|
+
| **Page section** | page title, viewport, regions and components on the page. No HTML. |
|
|
267
|
+
|
|
268
|
+
Every comment also carries the component, source file and line, up to three of *your* components above it (library frames are skipped), a trimmed HTML preview capped at 300 characters, and a screenshot. Styles are compared against browser defaults, so only the values your code set are reported.
|
|
269
|
+
|
|
270
|
+
The export names the page once, groups comments by file, and skips anything already visible in the preview. **Compact** is one line per comment; **Detailed** adds ancestors, position and all custom styles for tricky layout bugs. Twenty mixed comments fit comfortably under 6k tokens at the default level.
|
|
271
|
+
|
|
272
|
+
Screenshots are never pasted into the text; they'd crowd out the context window. They stay in the browser (and on your collector, if you use one), and `pull` and MCP give your agent the image file.
|
|
187
273
|
|
|
188
274
|
## Connect your AI agent
|
|
189
275
|
|
|
190
276
|
- **Copy all**: paste into any chat or agent.
|
|
191
|
-
- **MCP**: run `npx grabby add mcp`. Your agent gets `grabby_list_comments`, `grabby_get_comment` (with the screenshot), `grabby_resolve` and `grabby_stats`. Locally it also collects comments: set `initGrabby({ server: 'http://localhost:3456' })`. Against a deployed collector, add `--server <url> --token <sk_…>` to the MCP command.
|
|
277
|
+
- **MCP**: run `npx @githumbi/grabby add mcp`. Your agent gets `grabby_list_comments`, `grabby_get_comment` (with the screenshot), `grabby_resolve` and `grabby_stats`. Locally it also collects comments: set `initGrabby({ server: 'http://localhost:3456' })`. Against a deployed collector, add `--server <url> --token <sk_…>` to the MCP command.
|
|
192
278
|
- **`pull`**: prints the same export as Copy all, for scripts and terminal agents.
|
|
193
279
|
|
|
194
280
|
## Framework support
|
|
@@ -239,6 +325,7 @@ Mark parts of your page:
|
|
|
239
325
|
- **The UI is isolated** in a shadow root and built without `innerHTML`, so page CSS can't break it and nothing a user types can run as code. It works under strict CSP (`style-src 'self'`) and Trusted Types.
|
|
240
326
|
- **The collector** stays on localhost unless started with `--public`, and then refuses to start without an admin token, a project key and a list of allowed sites. The public key can only add comments; reading, resolving and deleting need the admin token. Input is validated and size-capped, screenshots are checked by their bytes, only the browser that wrote a comment can attach its screenshot, and requests are rate-limited. Locally, it rejects DNS-rebinding attempts.
|
|
241
327
|
- **Comments are user input.** MCP results tell your agent to treat them as data, not instructions. Review what an agent does with feedback from people you don't know.
|
|
328
|
+
- **Supply chain.** Neither package has install scripts. Everything Grabby generates for you is pinned to an exact version: the `.mcp.json` entry and `grabby pull` run one specific `@githumbi/grabby-server` release (re-run `npx @githumbi/grabby add mcp` after upgrading to move it), and the CDN tag from `@githumbi/grabby init` carries integrity hashes. Releases are built in CI and published with npm trusted publishing and provenance; see [SECURITY.md](SECURITY.md#how-releases-are-protected) for how the repository itself is hardened.
|
|
242
329
|
|
|
243
330
|
Report vulnerabilities privately; see [SECURITY.md](SECURITY.md).
|
|
244
331
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/grabby/grabby/packages/grabby/dist/chunk-6CBIOKZV.cjs","../src/core/live/activation.ts"],"names":[],"mappings":"AAAA;ACMO,IAAM,WAAA,EAAa,QAAA;AAC1B,IAAM,SAAA,EAAW,gBAAA;AAEjB,SAAS,OAAA,CAAA,EAA0B;AACjC,EAAA,IAAI;AAAE,IAAA,OAAO,MAAA,CAAO,cAAA;AAAA,EAAgB,EAAA,UAAQ;AAAE,IAAA,OAAO,IAAA;AAAA,EAAM;AAC7D;AAEO,SAAS,iBAAA,CAAA,EAA6B;AAC3C,EAAA,uBAAO,OAAA,iBAAQ,CAAA,6BAAG,OAAA,mBAAQ,QAAQ,IAAA,IAAM,GAAA;AAC1C;AAEO,SAAS,oBAAA,CAAA,EAA6B;AAC3C,EAAA,IAAI;AAAE,oBAAA,OAAA,mBAAQ,CAAA,6BAAG,OAAA,mBAAQ,QAAA,EAAU,GAAG,GAAA;AAAA,EAAG,EAAA,WAAQ;AAAA,EAA+C;AAClG;AAEO,SAAS,kBAAA,CAAA,EAA2B;AACzC,EAAA,IAAI;AAAE,oBAAA,OAAA,mBAAQ,CAAA,6BAAG,UAAA,mBAAW,QAAQ,GAAA;AAAA,EAAG,EAAA,WAAQ;AAAA,EAAe;AAChE;AAOO,SAAS,mBAAA,CAAoB,UAAA,EAA8B;AAChE,EAAA,IAAI;AACF,IAAA,MAAM,IAAA,EAAM,IAAI,GAAA,CAAI,MAAA,CAAO,QAAA,CAAS,IAAI,CAAA;AACxC,IAAA,MAAM,MAAA,EAAQ,GAAA,CAAI,YAAA,CAAa,GAAA,CAAI,UAAU,CAAA;AAC7C,IAAA,GAAA,CAAI,MAAA,IAAU,IAAA,EAAM;AAClB,MAAA,GAAA,CAAI,MAAA,GAAA,CAAU,CAAC,WAAA,GAAc,MAAA,IAAU,UAAA,CAAA,EAAa,oBAAA,CAAqB,CAAA;AACzE,MAAA,GAAA,CAAI,YAAA,CAAa,MAAA,CAAO,UAAU,CAAA;AAClC,MAAA,MAAA,CAAO,OAAA,CAAQ,YAAA,CAAa,MAAA,CAAO,OAAA,CAAQ,KAAA,EAAO,EAAA,EAAI,GAAA,CAAI,SAAA,EAAW,GAAA,CAAI,OAAA,EAAS,GAAA,CAAI,IAAI,CAAA;AAAA,IAC5F;AAAA,EACF,EAAA,WAAQ;AAAA,EAAwC;AAChD,EAAA,OAAO,iBAAA,CAAkB,CAAA;AAC3B;ADHA;AACA;AACE;AACA;AACA;AACF,wJAAC","file":"/home/runner/work/grabby/grabby/packages/grabby/dist/chunk-6CBIOKZV.cjs","sourcesContent":[null,"/**\n * Live sites keep Grabby hidden from ordinary visitors. It appears for\n * someone who opens a feedback link (https://site/?grabby=<projectKey>) and\n * stays for that browser tab until they exit feedback mode.\n */\n\nexport const LINK_PARAM = 'grabby';\nconst FLAG_KEY = 'grabby:v1:live';\n\nfunction session(): Storage | null {\n try { return window.sessionStorage; } catch { return null; }\n}\n\nexport function isFeedbackSession(): boolean {\n return session()?.getItem(FLAG_KEY) === '1';\n}\n\nexport function startFeedbackSession(): void {\n try { session()?.setItem(FLAG_KEY, '1'); } catch { /* private mode: lasts for this page only */ }\n}\n\nexport function endFeedbackSession(): void {\n try { session()?.removeItem(FLAG_KEY); } catch { /* ignore */ }\n}\n\n/**\n * Starts a feedback session if the URL carries a matching link, then removes\n * the parameter so it isn't shared by accident when the page is bookmarked\n * or copied. With no projectKey configured, any non-empty value works.\n */\nexport function consumeFeedbackLink(projectKey?: string): boolean {\n try {\n const url = new URL(window.location.href);\n const value = url.searchParams.get(LINK_PARAM);\n if (value !== null) {\n if (value && (!projectKey || value === projectKey)) startFeedbackSession();\n url.searchParams.delete(LINK_PARAM);\n window.history.replaceState(window.history.state, '', url.pathname + url.search + url.hash);\n }\n } catch { /* unusual URL; nothing to consume */ }\n return isFeedbackSession();\n}\n"]}
|
package/dist/cli/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { parseArgs } from "util";
|
|
|
6
6
|
|
|
7
7
|
// src/cli/commands/init.ts
|
|
8
8
|
import { execSync } from "child_process";
|
|
9
|
+
import { createHash } from "crypto";
|
|
9
10
|
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
10
11
|
import { join as join2, relative } from "path";
|
|
11
12
|
import { createInterface } from "readline";
|
|
@@ -130,6 +131,10 @@ function patchAngularAppConfig(code) {
|
|
|
130
131
|
return { status: "patched", code: insertImport(withProvider, "import { provideGrabby } from '@githumbi/grabby/angular';") };
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
// src/cli/versions.ts
|
|
135
|
+
var GRABBY_VERSION = "0.1.2";
|
|
136
|
+
var SERVER_PACKAGE = `@githumbi/grabby-server@${"0.1.0"}`;
|
|
137
|
+
|
|
133
138
|
// src/cli/commands/init.ts
|
|
134
139
|
var PKG = "@githumbi/grabby";
|
|
135
140
|
var c = {
|
|
@@ -139,6 +144,27 @@ var c = {
|
|
|
139
144
|
bold: (s) => `\x1B[1m${s}\x1B[0m`,
|
|
140
145
|
dim: (s) => `\x1B[2m${s}\x1B[0m`
|
|
141
146
|
};
|
|
147
|
+
function sri(file) {
|
|
148
|
+
try {
|
|
149
|
+
const data = readFileSync2(new URL(`../${file}`, import.meta.url));
|
|
150
|
+
return `sha384-${createHash("sha384").update(data).digest("base64")}`;
|
|
151
|
+
} catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function cdnScriptTag(live) {
|
|
156
|
+
const file = live ? "loader.global.js" : "grabby.global.js";
|
|
157
|
+
const own = sri(file);
|
|
158
|
+
const full = live ? sri("grabby.global.js") : null;
|
|
159
|
+
const attrs = [
|
|
160
|
+
`src="https://cdn.jsdelivr.net/npm/${PKG}@${GRABBY_VERSION}/dist/${file}"`,
|
|
161
|
+
...own ? [`integrity="${own}"`, 'crossorigin="anonymous"'] : [],
|
|
162
|
+
...full ? [`data-integrity="${full}"`] : [],
|
|
163
|
+
...live ? ['data-mode="live"', `data-server="${live.server}"`, `data-project-key="${live.projectKey}"`] : [],
|
|
164
|
+
"defer"
|
|
165
|
+
];
|
|
166
|
+
return `<script ${attrs.join(" ")}></script>`;
|
|
167
|
+
}
|
|
142
168
|
var log = (msg = "") => console.log(msg && `${c.cyan("[grabby]")} ${msg}`);
|
|
143
169
|
var warn = (msg) => console.log(`${c.yellow("[grabby]")} ${msg}`);
|
|
144
170
|
function tryPatch(file, patch, describe, manual, changes, manualSteps) {
|
|
@@ -218,12 +244,9 @@ function plan(stack, options) {
|
|
|
218
244
|
live ? `In a client-only script/plugin: import('@githumbi/grabby/live').then((g) => g.${liveCall});` : "In a client-only script/plugin: if (import.meta.env.DEV) import('@githumbi/grabby').then((g) => g.initGrabby());"
|
|
219
245
|
);
|
|
220
246
|
break;
|
|
221
|
-
default:
|
|
222
|
-
const attrs = live ? ` data-mode="live" data-server="${live.server}" data-project-key="${live.projectKey}"` : "";
|
|
223
|
-
const file = live ? "loader.global.js" : "grabby.global.js";
|
|
247
|
+
default:
|
|
224
248
|
manual.push(`Add before </body>:
|
|
225
|
-
|
|
226
|
-
}
|
|
249
|
+
${cdnScriptTag(live)}`);
|
|
227
250
|
}
|
|
228
251
|
return { changes, manual, devDependency: !live };
|
|
229
252
|
}
|
|
@@ -278,13 +301,13 @@ async function init(options = {}) {
|
|
|
278
301
|
if (options.live) {
|
|
279
302
|
console.log(`
|
|
280
303
|
Share this feedback link with reviewers: ${c.bold(`https://<your-site>/?grabby=${options.live.projectKey}`)}`);
|
|
281
|
-
console.log(` Pull their comments: ${c.bold(`npx
|
|
304
|
+
console.log(` Pull their comments: ${c.bold(`npx -y ${SERVER_PACKAGE} pull --server ${options.live.server} --token <admin token>`)}
|
|
282
305
|
`);
|
|
283
306
|
} else {
|
|
284
307
|
console.log(`
|
|
285
308
|
Start your dev server, press ${c.bold("Alt+G")} (${c.bold("Option+G")} on Mac), click anything, and comment.`);
|
|
286
309
|
console.log(` Then use ${c.bold("Copy all")} and paste into your AI agent.`);
|
|
287
|
-
console.log(` Want your agent to read comments directly? Run ${c.bold("npx grabby add mcp")}.
|
|
310
|
+
console.log(` Want your agent to read comments directly? Run ${c.bold("npx @githumbi/grabby add mcp")}.
|
|
288
311
|
`);
|
|
289
312
|
}
|
|
290
313
|
}
|
|
@@ -292,7 +315,6 @@ async function init(options = {}) {
|
|
|
292
315
|
// src/cli/commands/add-mcp.ts
|
|
293
316
|
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
294
317
|
import { join as join3 } from "path";
|
|
295
|
-
var MCP_PACKAGE = "@githumbi/grabby-server@0";
|
|
296
318
|
var MCP_SERVER_NAME = "grabby";
|
|
297
319
|
function log2(msg) {
|
|
298
320
|
console.log(`\x1B[36m[grabby]\x1B[0m ${msg}`);
|
|
@@ -309,13 +331,13 @@ function getMcpServerEntry() {
|
|
|
309
331
|
return {
|
|
310
332
|
type: "stdio",
|
|
311
333
|
command: "cmd",
|
|
312
|
-
args: ["/c", "npx", "-y",
|
|
334
|
+
args: ["/c", "npx", "-y", SERVER_PACKAGE, "mcp"]
|
|
313
335
|
};
|
|
314
336
|
}
|
|
315
337
|
return {
|
|
316
338
|
type: "stdio",
|
|
317
339
|
command: "npx",
|
|
318
|
-
args: ["-y",
|
|
340
|
+
args: ["-y", SERVER_PACKAGE, "mcp"]
|
|
319
341
|
};
|
|
320
342
|
}
|
|
321
343
|
async function addMcp() {
|
|
@@ -349,14 +371,14 @@ async function addMcp() {
|
|
|
349
371
|
var HELP = `Grabby: point at any UI element, leave a comment, hand it to your AI agent.
|
|
350
372
|
|
|
351
373
|
Usage
|
|
352
|
-
npx grabby init
|
|
374
|
+
npx @githumbi/grabby init Set up Grabby in this project (asks before changing files)
|
|
353
375
|
--yes Apply without asking
|
|
354
376
|
--dry-run Only show what would change
|
|
355
377
|
--no-install Don't install the package
|
|
356
378
|
--live --server <url> --key <pk_\u2026>
|
|
357
379
|
Set up live-site feedback instead of local dev mode
|
|
358
|
-
npx grabby add mcp
|
|
359
|
-
npx grabby pull
|
|
380
|
+
npx @githumbi/grabby add mcp Let your AI agent read comments over MCP (.mcp.json)
|
|
381
|
+
npx @githumbi/grabby pull Print collected comments for your agent (runs grabby-server pull)
|
|
360
382
|
`;
|
|
361
383
|
function fail(err) {
|
|
362
384
|
console.error("\x1B[31mError:\x1B[0m", err instanceof Error ? err.message : String(err));
|
|
@@ -365,7 +387,7 @@ function fail(err) {
|
|
|
365
387
|
var argv = process.argv.slice(2);
|
|
366
388
|
var [command, subcommand] = argv;
|
|
367
389
|
if (command === "pull") {
|
|
368
|
-
const args = ["-y",
|
|
390
|
+
const args = ["-y", SERVER_PACKAGE, "pull", ...argv.slice(1)];
|
|
369
391
|
const windows = process.platform === "win32";
|
|
370
392
|
if (windows && !args.every((a) => /^[\w@./:=,+-]+$/.test(a))) {
|
|
371
393
|
fail(`unsupported characters in arguments; run it directly: npx ${args.join(" ")}`);
|