@githumbi/grabby 0.1.1 → 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 +6 -0
- package/README.md +156 -70
- package/dist/cli/index.js +5 -5
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
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
|
+
|
|
3
9
|
## 0.1.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
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
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,7 +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.
|
|
242
|
-
- **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 grabby add mcp` after upgrading to move it), and the CDN tag from
|
|
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.
|
|
243
329
|
|
|
244
330
|
Report vulnerabilities privately; see [SECURITY.md](SECURITY.md).
|
|
245
331
|
|
package/dist/cli/index.js
CHANGED
|
@@ -132,7 +132,7 @@ function patchAngularAppConfig(code) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
// src/cli/versions.ts
|
|
135
|
-
var GRABBY_VERSION = "0.1.
|
|
135
|
+
var GRABBY_VERSION = "0.1.2";
|
|
136
136
|
var SERVER_PACKAGE = `@githumbi/grabby-server@${"0.1.0"}`;
|
|
137
137
|
|
|
138
138
|
// src/cli/commands/init.ts
|
|
@@ -307,7 +307,7 @@ async function init(options = {}) {
|
|
|
307
307
|
console.log(`
|
|
308
308
|
Start your dev server, press ${c.bold("Alt+G")} (${c.bold("Option+G")} on Mac), click anything, and comment.`);
|
|
309
309
|
console.log(` Then use ${c.bold("Copy all")} and paste into your AI agent.`);
|
|
310
|
-
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")}.
|
|
311
311
|
`);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
@@ -371,14 +371,14 @@ async function addMcp() {
|
|
|
371
371
|
var HELP = `Grabby: point at any UI element, leave a comment, hand it to your AI agent.
|
|
372
372
|
|
|
373
373
|
Usage
|
|
374
|
-
npx grabby init
|
|
374
|
+
npx @githumbi/grabby init Set up Grabby in this project (asks before changing files)
|
|
375
375
|
--yes Apply without asking
|
|
376
376
|
--dry-run Only show what would change
|
|
377
377
|
--no-install Don't install the package
|
|
378
378
|
--live --server <url> --key <pk_\u2026>
|
|
379
379
|
Set up live-site feedback instead of local dev mode
|
|
380
|
-
npx grabby add mcp
|
|
381
|
-
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)
|
|
382
382
|
`;
|
|
383
383
|
function fail(err) {
|
|
384
384
|
console.error("\x1B[31mError:\x1B[0m", err instanceof Error ? err.message : String(err));
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/init.ts","../../src/cli/utils/detect-stack.ts","../../src/cli/utils/patch-source.ts","../../src/cli/versions.ts","../../src/cli/commands/add-mcp.ts"],"sourcesContent":["import { spawn } from 'child_process';\nimport { parseArgs } from 'util';\nimport { init } from './commands/init';\nimport { addMcp } from './commands/add-mcp';\nimport { SERVER_PACKAGE } from './versions';\n\nconst HELP = `Grabby: point at any UI element, leave a comment, hand it to your AI agent.\n\nUsage\n npx grabby init Set up Grabby in this project (asks before changing files)\n --yes Apply without asking\n --dry-run Only show what would change\n --no-install Don't install the package\n --live --server <url> --key <pk_…>\n Set up live-site feedback instead of local dev mode\n npx grabby add mcp Let your AI agent read comments over MCP (.mcp.json)\n npx grabby pull [options] Print collected comments for your agent (runs grabby-server pull)\n`;\n\nfunction fail(err: unknown): never {\n console.error('\\x1b[31mError:\\x1b[0m', err instanceof Error ? err.message : String(err));\n process.exit(1);\n}\n\nconst argv = process.argv.slice(2);\nconst [command, subcommand] = argv;\n\nif (command === 'pull') {\n // The collector owns pulling; forward to it so there's one implementation.\n const args = ['-y', SERVER_PACKAGE, 'pull', ...argv.slice(1)];\n const windows = process.platform === 'win32';\n // npx is a .cmd on Windows, which Node only runs through a shell. Only\n // pass plain flag/value characters so nothing can be interpreted by it.\n if (windows && !args.every((a) => /^[\\w@./:=,+-]+$/.test(a))) {\n fail(`unsupported characters in arguments; run it directly: npx ${args.join(' ')}`);\n }\n const child = spawn(windows ? 'npx.cmd' : 'npx', args, { stdio: 'inherit', shell: windows });\n child.on('exit', (code) => process.exit(code ?? 1));\n} else if (command === 'add' && subcommand === 'mcp') {\n addMcp().catch(fail);\n} else if (!command || command === 'init') {\n const { values } = parseArgs({\n args: argv.slice(command ? 1 : 0),\n options: {\n yes: { type: 'boolean', short: 'y' },\n 'dry-run': { type: 'boolean' },\n 'no-install': { type: 'boolean' },\n live: { type: 'boolean' },\n server: { type: 'string' },\n key: { type: 'string' },\n },\n });\n if (values.live && (!values.server || !values.key)) {\n fail('--live needs --server <collector url> and --key <project key> (from `npx @githumbi/grabby-server init`)');\n }\n init({\n yes: values.yes,\n dryRun: values['dry-run'],\n noInstall: values['no-install'],\n live: values.live ? { server: values.server!, projectKey: values.key! } : undefined,\n }).catch(fail);\n} else if (command === 'help' || command === '--help' || command === '-h') {\n console.log(HELP);\n} else {\n console.error(`Unknown command: ${argv.join(' ')}\\n`);\n console.log(HELP);\n process.exit(1);\n}\n","import { execSync } from 'child_process';\nimport { createHash } from 'crypto';\nimport { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { join, relative } from 'path';\nimport { createInterface } from 'readline';\nimport { detectStack, installCommand, type Stack } from '../utils/detect-stack';\nimport { patchViteConfig, patchEntry, patchAngularJson, patchAngularAppConfig, type PatchResult } from '../utils/patch-source';\nimport { GRABBY_VERSION, SERVER_PACKAGE } from '../versions';\n\nconst PKG = '@githumbi/grabby';\n\nexport interface InitOptions {\n cwd?: string;\n /** Apply without asking. */\n yes?: boolean;\n /** Show the plan only. */\n dryRun?: boolean;\n /** Skip installing the package. */\n noInstall?: boolean;\n /** Set up live-site feedback instead of local developer mode. */\n live?: { server: string; projectKey: string };\n}\n\nconst c = {\n cyan: (s: string) => `\\x1b[36m${s}\\x1b[0m`,\n yellow: (s: string) => `\\x1b[33m${s}\\x1b[0m`,\n green: (s: string) => `\\x1b[32m${s}\\x1b[0m`,\n bold: (s: string) => `\\x1b[1m${s}\\x1b[0m`,\n dim: (s: string) => `\\x1b[2m${s}\\x1b[0m`,\n};\n\n/**\n * Subresource Integrity for a script-tag build shipped next to this CLI\n * (dist/cli → dist). It's the same file jsDelivr serves for this exact\n * version, so a tampered CDN copy won't run.\n */\nfunction sri(file: string): string | null {\n try {\n const data = readFileSync(new URL(`../${file}`, import.meta.url));\n return `sha384-${createHash('sha384').update(data).digest('base64')}`;\n } catch {\n return null; // running from source\n }\n}\n\n/** A script tag pinned to this exact version, with integrity hashes. */\nexport function cdnScriptTag(live?: { server: string; projectKey: string }): string {\n const file = live ? 'loader.global.js' : 'grabby.global.js';\n const own = sri(file);\n // The loader fetches the full build itself; data-integrity covers that file.\n const full = live ? sri('grabby.global.js') : null;\n const attrs = [\n `src=\"https://cdn.jsdelivr.net/npm/${PKG}@${GRABBY_VERSION}/dist/${file}\"`,\n ...(own ? [`integrity=\"${own}\"`, 'crossorigin=\"anonymous\"'] : []),\n ...(full ? [`data-integrity=\"${full}\"`] : []),\n ...(live ? ['data-mode=\"live\"', `data-server=\"${live.server}\"`, `data-project-key=\"${live.projectKey}\"`] : []),\n 'defer',\n ];\n return `<script ${attrs.join(' ')}></script>`;\n}\n\nconst log = (msg = '') => console.log(msg && `${c.cyan('[grabby]')} ${msg}`);\nconst warn = (msg: string) => console.log(`${c.yellow('[grabby]')} ${msg}`);\n\ninterface Change {\n file: string;\n describe: string;\n next: string;\n}\n\nfunction tryPatch(file: string | null, patch: (code: string) => PatchResult, describe: string, manual: string, changes: Change[], manualSteps: string[]): void {\n if (!file || !existsSync(file)) {\n manualSteps.push(manual);\n return;\n }\n const result = patch(readFileSync(file, 'utf8'));\n if (result.status === 'patched') changes.push({ file, describe, next: result.code });\n else if (result.status === 'already') log(`${describe}: already set up`);\n else manualSteps.push(`${manual}\\n ${c.dim(`(couldn't edit ${file} automatically: ${result.reason})`)}`);\n}\n\n/** What to change for each stack. Anything not safely automatable becomes a manual step. */\nfunction plan(stack: Stack, options: InitOptions): { changes: Change[]; manual: string[]; devDependency: boolean } {\n const changes: Change[] = [];\n const manual: string[] = [];\n const live = options.live;\n const liveCall = live ? `initGrabbyLive({ server: '${live.server}', projectKey: '${live.projectKey}' })` : '';\n\n switch (stack.framework) {\n case 'angular': {\n tryPatch(join(stack.root, 'angular.json'), patchAngularJson, 'use the Grabby builders',\n 'In angular.json, set build → \"@githumbi/grabby:application\" and serve → \"@githumbi/grabby:dev-server\".', changes, manual);\n const appConfig = ['src/app/app.config.ts', 'src/app.config.ts'].map((f) => join(stack.root, f)).find((f) => existsSync(f)) ?? null;\n tryPatch(appConfig, patchAngularAppConfig, 'add provideGrabby()',\n \"In app.config.ts: import { provideGrabby } from '@githumbi/grabby/angular'; and add provideGrabby() to providers.\", changes, manual);\n if (live) manual.push(`For live feedback, pass the options: provideGrabby({ mode: 'live', server: '${live.server}', projectKey: '${live.projectKey}' })`);\n break;\n }\n case 'react':\n case 'vue':\n case 'svelte':\n case 'solid':\n case 'preact': {\n if (stack.framework !== 'svelte' && !live) {\n tryPatch(stack.viteConfig, patchViteConfig, 'add the source-location plugin',\n \"In your bundler config add the plugin first: import grabby from '@githumbi/grabby/plugin'; plugins: [grabby.vite(), …] (also grabby.webpack(), grabby.rspack(), …)\", changes, manual);\n }\n tryPatch(stack.entry, (code) => patchEntry(code, { live }), live ? 'start live feedback' : 'start Grabby in development builds',\n live\n ? `In your entry file: import { initGrabbyLive } from '@githumbi/grabby/live'; ${liveCall};`\n : \"In your entry file: import { initGrabby } from '@githumbi/grabby'; if (import.meta.env.DEV) initGrabby();\", changes, manual);\n break;\n }\n case 'next':\n manual.push(\n \"next.config: const grabby = require('@githumbi/grabby/plugin').default; webpack: (config) => { config.plugins.unshift(grabby.webpack()); return config; }\",\n live\n ? `In a client component rendered by your root layout: useEffect(() => { import('@githumbi/grabby/live').then((g) => g.${liveCall}); }, []);`\n : \"In a client component rendered by your root layout: useEffect(() => { if (process.env.NODE_ENV === 'development') import('@githumbi/grabby').then((g) => g.initGrabby()); }, []);\",\n );\n break;\n case 'nuxt':\n case 'sveltekit':\n case 'astro':\n manual.push(\n stack.framework === 'nuxt' ? \"nuxt.config: vite: { plugins: [require('@githumbi/grabby/plugin').default.vite()] }\" : 'No build plugin needed for Svelte-based apps; Astro can add grabby.vite() under vite.plugins.',\n live\n ? `In a client-only script/plugin: import('@githumbi/grabby/live').then((g) => g.${liveCall});`\n : \"In a client-only script/plugin: if (import.meta.env.DEV) import('@githumbi/grabby').then((g) => g.initGrabby());\",\n );\n break;\n default:\n manual.push(`Add before </body>:\\n ${cdnScriptTag(live)}`);\n }\n\n return { changes, manual, devDependency: !live };\n}\n\nasync function confirm(question: string): Promise<boolean> {\n if (!process.stdin.isTTY) return false;\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n const answer = await new Promise<string>((resolve) => rl.question(question, resolve));\n rl.close();\n return /^y(es)?$/i.test(answer.trim());\n}\n\nexport async function init(options: InitOptions = {}): Promise<void> {\n const stack = detectStack(options.cwd);\n const rel = (f: string) => relative(stack.root, f) || f;\n log(`Project: ${stack.root}`);\n log(`Detected: ${stack.framework}${stack.viteConfig ? ' + Vite' : ''} · ${stack.packageManager}${options.live ? ' · live feedback' : ''}`);\n log();\n\n const { changes, manual, devDependency } = plan(stack, options);\n const install = stack.hasPackageJson && !options.noInstall ? installCommand(stack.packageManager, PKG, devDependency) : null;\n\n if (!install && changes.length === 0 && manual.length === 0) {\n log(c.green('Everything is already set up.'));\n return;\n }\n\n console.log(c.bold(' Grabby will:'));\n if (install) console.log(` • run ${c.bold(install)}`);\n for (const ch of changes) console.log(` • edit ${c.bold(rel(ch.file))}: ${ch.describe}`);\n if (manual.length) {\n console.log(c.bold('\\n You\\'ll need to do by hand:'));\n manual.forEach((m, i) => console.log(` ${i + 1}. ${m}`));\n }\n console.log('');\n\n if (options.dryRun) return;\n if (changes.length || install) {\n const go = options.yes || await confirm(' Go ahead? [y/N] ');\n if (!go) {\n warn(process.stdin.isTTY ? 'Nothing changed.' : 'Nothing changed (not a terminal; re-run with --yes to apply).');\n return;\n }\n }\n\n if (install) {\n try {\n execSync(install, { cwd: stack.root, stdio: 'inherit' });\n } catch {\n warn(`Install failed; run it yourself: ${install}`);\n }\n }\n for (const ch of changes) {\n writeFileSync(ch.file, ch.next, 'utf8');\n log(`${c.green('✓')} ${rel(ch.file)}`);\n }\n\n console.log('');\n log(c.green('Done.'));\n if (options.live) {\n console.log(`\\n Share this feedback link with reviewers: ${c.bold(`https://<your-site>/?grabby=${options.live.projectKey}`)}`);\n console.log(` Pull their comments: ${c.bold(`npx -y ${SERVER_PACKAGE} pull --server ${options.live.server} --token <admin token>`)}\\n`);\n } else {\n console.log(`\\n Start your dev server, press ${c.bold('Alt+G')} (${c.bold('Option+G')} on Mac), click anything, and comment.`);\n console.log(` Then use ${c.bold('Copy all')} and paste into your AI agent.`);\n console.log(` Want your agent to read comments directly? Run ${c.bold('npx grabby add mcp')}.\\n`);\n }\n}\n","import { existsSync, readFileSync } from 'fs';\nimport { join, dirname } from 'path';\n\nexport type PackageManager = 'pnpm' | 'yarn' | 'bun' | 'npm';\nexport type Framework = 'angular' | 'next' | 'nuxt' | 'sveltekit' | 'astro' | 'react' | 'vue' | 'svelte' | 'solid' | 'preact' | 'html';\n\nexport interface Stack {\n root: string;\n packageManager: PackageManager;\n framework: Framework;\n /** vite.config.* when the project builds with Vite. */\n viteConfig: string | null;\n /** The file that mounts the app, where initGrabby() goes. */\n entry: string | null;\n hasPackageJson: boolean;\n}\n\nconst VITE_CONFIGS = ['vite.config.ts', 'vite.config.mts', 'vite.config.js', 'vite.config.mjs'];\nconst ENTRIES = ['src/main.tsx', 'src/main.ts', 'src/main.jsx', 'src/main.js', 'src/index.tsx', 'src/index.jsx', 'src/index.ts', 'src/index.js'];\n\nexport function findProjectRoot(start: string = process.cwd()): string {\n let dir = start;\n while (true) {\n if (existsSync(join(dir, 'package.json'))) return dir;\n const parent = dirname(dir);\n if (parent === dir) return start;\n dir = parent;\n }\n}\n\nexport function detectPackageManager(root: string): PackageManager {\n // Walk up for lockfiles too: a workspace package's lockfile lives at the repo root.\n let dir = root;\n while (true) {\n if (existsSync(join(dir, 'pnpm-lock.yaml'))) return 'pnpm';\n if (existsSync(join(dir, 'yarn.lock'))) return 'yarn';\n if (existsSync(join(dir, 'bun.lockb')) || existsSync(join(dir, 'bun.lock'))) return 'bun';\n if (existsSync(join(dir, 'package-lock.json'))) return 'npm';\n const parent = dirname(dir);\n if (parent === dir) return 'npm';\n dir = parent;\n }\n}\n\nexport function detectStack(start: string = process.cwd()): Stack {\n const root = findProjectRoot(start);\n const pkgPath = join(root, 'package.json');\n const hasPackageJson = existsSync(pkgPath);\n let deps: Record<string, string> = {};\n if (hasPackageJson) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));\n deps = { ...pkg.dependencies, ...pkg.devDependencies };\n } catch { /* unreadable package.json: treat as plain HTML */ }\n }\n const has = (name: string) => name in deps;\n\n let framework: Framework = 'html';\n if (existsSync(join(root, 'angular.json')) || has('@angular/core')) framework = 'angular';\n else if (has('next')) framework = 'next';\n else if (has('nuxt')) framework = 'nuxt';\n else if (has('@sveltejs/kit')) framework = 'sveltekit';\n else if (has('astro')) framework = 'astro';\n else if (has('solid-js')) framework = 'solid';\n else if (has('preact')) framework = 'preact';\n else if (has('react')) framework = 'react';\n else if (has('vue')) framework = 'vue';\n else if (has('svelte')) framework = 'svelte';\n\n const viteConfig = VITE_CONFIGS.map((f) => join(root, f)).find((f) => existsSync(f)) ?? null;\n const entry = ENTRIES.map((f) => join(root, f)).find((f) => existsSync(f)) ?? null;\n\n return { root, packageManager: detectPackageManager(root), framework, viteConfig, entry, hasPackageJson };\n}\n\nexport function installCommand(pm: PackageManager, pkg: string, dev: boolean): string {\n switch (pm) {\n case 'pnpm': return `pnpm add ${dev ? '-D ' : ''}${pkg}`;\n case 'yarn': return `yarn add ${dev ? '-D ' : ''}${pkg}`;\n case 'bun': return `bun add ${dev ? '-d ' : ''}${pkg}`;\n default: return `npm install ${dev ? '-D ' : ''}${pkg}`;\n }\n}\n","/*\n * Small, conservative source edits. Each patch either applies cleanly to a\n * recognisable pattern or declines, so `grabby init` never writes a guess;\n * when it declines, init prints the lines to add by hand instead.\n */\n\nexport type PatchResult =\n | { status: 'patched'; code: string }\n | { status: 'already' }\n | { status: 'unrecognised'; reason: string };\n\n/** Index just after the last top-level import statement (0 when there are none). */\nfunction afterImports(code: string): number {\n const re = /^import\\s[^;]*?(?:from\\s+)?['\"][^'\"]+['\"];?[ \\t]*$/gm;\n let end = 0;\n for (let m = re.exec(code); m; m = re.exec(code)) end = m.index + m[0].length;\n return end;\n}\n\nfunction insertImport(code: string, statement: string): string {\n const at = afterImports(code);\n if (at === 0) return `${statement}\\n${code}`;\n return `${code.slice(0, at)}\\n${statement}${code.slice(at)}`;\n}\n\n/** Adds `grabby.vite()` first in the `plugins: [...]` array of a Vite config. */\nexport function patchViteConfig(code: string): PatchResult {\n if (code.includes('@githumbi/grabby/plugin')) return { status: 'already' };\n const plugins = /plugins\\s*:\\s*\\[/.exec(code);\n if (!plugins) return { status: 'unrecognised', reason: 'no `plugins: [ … ]` array found' };\n const at = plugins.index + plugins[0].length;\n // First, so it stamps source before framework plugins compile it.\n const withPlugin = `${code.slice(0, at)}grabby.vite(), ${code.slice(at)}`;\n return { status: 'patched', code: insertImport(withPlugin, \"import grabby from '@githumbi/grabby/plugin';\") };\n}\n\n/** Starts Grabby in the app's entry file, in development builds only. */\nexport function patchEntry(code: string, options: { live?: { server: string; projectKey: string } } = {}): PatchResult {\n if (code.includes('@githumbi/grabby')) return { status: 'already' };\n const at = afterImports(code);\n if (at === 0 && /\\bimport\\b/.test(code.slice(0, 200))) {\n return { status: 'unrecognised', reason: 'could not find where the imports end' };\n }\n const call = options.live\n ? `initGrabbyLive({ server: ${JSON.stringify(options.live.server)}, projectKey: ${JSON.stringify(options.live.projectKey)} });`\n : 'if (import.meta.env.DEV) initGrabby();';\n const imp = options.live\n ? \"import { initGrabbyLive } from '@githumbi/grabby/live';\"\n : \"import { initGrabby } from '@githumbi/grabby';\";\n const withImport = insertImport(code, imp);\n const afterAll = afterImports(withImport);\n return { status: 'patched', code: `${withImport.slice(0, afterAll)}\\n\\n${call}${withImport.slice(afterAll)}` };\n}\n\n/**\n * Swaps the Angular builders for Grabby's, editing the builder strings in\n * place so angular.json keeps its formatting (and any comments).\n */\nexport function patchAngularJson(code: string): PatchResult {\n if (code.includes('@githumbi/grabby:')) return { status: 'already' };\n const next = code\n .replace(/\"@angular(?:-devkit\\/build-angular|\\/build):application\"/g, '\"@githumbi/grabby:application\"')\n .replace(/\"@angular(?:-devkit\\/build-angular|\\/build):dev-server\"/g, '\"@githumbi/grabby:dev-server\"');\n if (next === code) {\n return { status: 'unrecognised', reason: 'no @angular/build:application or :dev-server builder found (Angular 17+ is required)' };\n }\n return { status: 'patched', code: next };\n}\n\n/** Adds provideGrabby() to the providers array of app.config.ts. */\nexport function patchAngularAppConfig(code: string): PatchResult {\n if (code.includes('provideGrabby')) return { status: 'already' };\n const providers = /providers\\s*:\\s*\\[/.exec(code);\n if (!providers) return { status: 'unrecognised', reason: 'no `providers: [ … ]` array found' };\n const at = providers.index + providers[0].length;\n const withProvider = `${code.slice(0, at)}provideGrabby(), ${code.slice(at)}`;\n return { status: 'patched', code: insertImport(withProvider, \"import { provideGrabby } from '@githumbi/grabby/angular';\") };\n}\n","declare const __GRABBY_VERSION__: string;\ndeclare const __GRABBY_SERVER_VERSION__: string;\n\n/** This package's version, filled in at build time. */\nexport const GRABBY_VERSION = __GRABBY_VERSION__;\n\n/**\n * The collector, pinned to an exact version. An MCP server runs with your\n * editor's permissions, and `npx` re-resolves a range on every launch, so a\n * range would let one bad publish reach every user at once. Re-running\n * `grabby add mcp` after upgrading Grabby moves the pin.\n */\nexport const SERVER_PACKAGE = `@githumbi/grabby-server@${__GRABBY_SERVER_VERSION__}`;\n","import { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\nimport { SERVER_PACKAGE as MCP_PACKAGE } from '../versions';\nconst MCP_SERVER_NAME = 'grabby';\n\nfunction log(msg: string): void {\n console.log(`\\x1b[36m[grabby]\\x1b[0m ${msg}`);\n}\n\nfunction warn(msg: string): void {\n console.log(`\\x1b[33m[grabby]\\x1b[0m ${msg}`);\n}\n\nfunction success(msg: string): void {\n console.log(`\\x1b[32m[grabby]\\x1b[0m ${msg}`);\n}\n\nfunction getMcpServerEntry(): { type: string; command: string; args: string[] } {\n const isWindows = process.platform === 'win32';\n if (isWindows) {\n return {\n type: 'stdio',\n command: 'cmd',\n args: ['/c', 'npx', '-y', MCP_PACKAGE, 'mcp'],\n };\n }\n return {\n type: 'stdio',\n command: 'npx',\n args: ['-y', MCP_PACKAGE, 'mcp'],\n };\n}\n\nexport async function addMcp(): Promise<void> {\n log('Adding grabby MCP server...\\n');\n\n const mcpJsonPath = join(process.cwd(), '.mcp.json');\n let config: Record<string, unknown> = {};\n\n if (existsSync(mcpJsonPath)) {\n try {\n config = JSON.parse(readFileSync(mcpJsonPath, 'utf-8'));\n } catch {\n // Never clobber a file we can't read: it may hold other servers' config.\n warn('.mcp.json exists but is not valid JSON; leaving it alone. Add this entry by hand:');\n console.log(JSON.stringify({ mcpServers: { [MCP_SERVER_NAME]: getMcpServerEntry() } }, null, 2));\n return;\n }\n }\n\n const servers = (config.mcpServers as Record<string, unknown>) ?? {};\n servers[MCP_SERVER_NAME] = getMcpServerEntry();\n config.mcpServers = servers;\n\n writeFileSync(mcpJsonPath, JSON.stringify(config, null, 2) + '\\n');\n success('Added grabby MCP server to .mcp.json');\n\n console.log('');\n console.log(' It also collects comments from your app on http://localhost:3456.');\n console.log(\" Point Grabby at it: initGrabby({ server: 'http://localhost:3456' })\");\n console.log('');\n console.log(' \\x1b[1mRestart your editor\\x1b[0m to activate the MCP connection.');\n console.log(' When prompted, \\x1b[1mapprove the MCP server\\x1b[0m in your editor.');\n console.log('');\n}\n"],"mappings":";;;AAAA,SAAS,aAAa;AACtB,SAAS,iBAAiB;;;ACD1B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,cAAAA,aAAY,gBAAAC,eAAc,qBAAqB;AACxD,SAAS,QAAAC,OAAM,gBAAgB;AAC/B,SAAS,uBAAuB;;;ACJhC,SAAS,YAAY,oBAAoB;AACzC,SAAS,MAAM,eAAe;AAgB9B,IAAM,eAAe,CAAC,kBAAkB,mBAAmB,kBAAkB,iBAAiB;AAC9F,IAAM,UAAU,CAAC,gBAAgB,eAAe,gBAAgB,eAAe,iBAAiB,iBAAiB,gBAAgB,cAAc;AAExI,SAAS,gBAAgB,QAAgB,QAAQ,IAAI,GAAW;AACrE,MAAI,MAAM;AACV,SAAO,MAAM;AACX,QAAI,WAAW,KAAK,KAAK,cAAc,CAAC,EAAG,QAAO;AAClD,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK,QAAO;AAC3B,UAAM;AAAA,EACR;AACF;AAEO,SAAS,qBAAqB,MAA8B;AAEjE,MAAI,MAAM;AACV,SAAO,MAAM;AACX,QAAI,WAAW,KAAK,KAAK,gBAAgB,CAAC,EAAG,QAAO;AACpD,QAAI,WAAW,KAAK,KAAK,WAAW,CAAC,EAAG,QAAO;AAC/C,QAAI,WAAW,KAAK,KAAK,WAAW,CAAC,KAAK,WAAW,KAAK,KAAK,UAAU,CAAC,EAAG,QAAO;AACpF,QAAI,WAAW,KAAK,KAAK,mBAAmB,CAAC,EAAG,QAAO;AACvD,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK,QAAO;AAC3B,UAAM;AAAA,EACR;AACF;AAEO,SAAS,YAAY,QAAgB,QAAQ,IAAI,G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AQ,KAAK,CAAC;AAChB;","names":["existsSync","readFileSync","join","readFileSync","existsSync","join","existsSync","readFileSync","writeFileSync","join","log","warn","join","existsSync","readFileSync","writeFileSync"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/commands/init.ts","../../src/cli/utils/detect-stack.ts","../../src/cli/utils/patch-source.ts","../../src/cli/versions.ts","../../src/cli/commands/add-mcp.ts"],"sourcesContent":["import { spawn } from 'child_process';\nimport { parseArgs } from 'util';\nimport { init } from './commands/init';\nimport { addMcp } from './commands/add-mcp';\nimport { SERVER_PACKAGE } from './versions';\n\nconst HELP = `Grabby: point at any UI element, leave a comment, hand it to your AI agent.\n\nUsage\n npx @githumbi/grabby init Set up Grabby in this project (asks before changing files)\n --yes Apply without asking\n --dry-run Only show what would change\n --no-install Don't install the package\n --live --server <url> --key <pk_…>\n Set up live-site feedback instead of local dev mode\n npx @githumbi/grabby add mcp Let your AI agent read comments over MCP (.mcp.json)\n npx @githumbi/grabby pull Print collected comments for your agent (runs grabby-server pull)\n`;\n\nfunction fail(err: unknown): never {\n console.error('\\x1b[31mError:\\x1b[0m', err instanceof Error ? err.message : String(err));\n process.exit(1);\n}\n\nconst argv = process.argv.slice(2);\nconst [command, subcommand] = argv;\n\nif (command === 'pull') {\n // The collector owns pulling; forward to it so there's one implementation.\n const args = ['-y', SERVER_PACKAGE, 'pull', ...argv.slice(1)];\n const windows = process.platform === 'win32';\n // npx is a .cmd on Windows, which Node only runs through a shell. Only\n // pass plain flag/value characters so nothing can be interpreted by it.\n if (windows && !args.every((a) => /^[\\w@./:=,+-]+$/.test(a))) {\n fail(`unsupported characters in arguments; run it directly: npx ${args.join(' ')}`);\n }\n const child = spawn(windows ? 'npx.cmd' : 'npx', args, { stdio: 'inherit', shell: windows });\n child.on('exit', (code) => process.exit(code ?? 1));\n} else if (command === 'add' && subcommand === 'mcp') {\n addMcp().catch(fail);\n} else if (!command || command === 'init') {\n const { values } = parseArgs({\n args: argv.slice(command ? 1 : 0),\n options: {\n yes: { type: 'boolean', short: 'y' },\n 'dry-run': { type: 'boolean' },\n 'no-install': { type: 'boolean' },\n live: { type: 'boolean' },\n server: { type: 'string' },\n key: { type: 'string' },\n },\n });\n if (values.live && (!values.server || !values.key)) {\n fail('--live needs --server <collector url> and --key <project key> (from `npx @githumbi/grabby-server init`)');\n }\n init({\n yes: values.yes,\n dryRun: values['dry-run'],\n noInstall: values['no-install'],\n live: values.live ? { server: values.server!, projectKey: values.key! } : undefined,\n }).catch(fail);\n} else if (command === 'help' || command === '--help' || command === '-h') {\n console.log(HELP);\n} else {\n console.error(`Unknown command: ${argv.join(' ')}\\n`);\n console.log(HELP);\n process.exit(1);\n}\n","import { execSync } from 'child_process';\nimport { createHash } from 'crypto';\nimport { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { join, relative } from 'path';\nimport { createInterface } from 'readline';\nimport { detectStack, installCommand, type Stack } from '../utils/detect-stack';\nimport { patchViteConfig, patchEntry, patchAngularJson, patchAngularAppConfig, type PatchResult } from '../utils/patch-source';\nimport { GRABBY_VERSION, SERVER_PACKAGE } from '../versions';\n\nconst PKG = '@githumbi/grabby';\n\nexport interface InitOptions {\n cwd?: string;\n /** Apply without asking. */\n yes?: boolean;\n /** Show the plan only. */\n dryRun?: boolean;\n /** Skip installing the package. */\n noInstall?: boolean;\n /** Set up live-site feedback instead of local developer mode. */\n live?: { server: string; projectKey: string };\n}\n\nconst c = {\n cyan: (s: string) => `\\x1b[36m${s}\\x1b[0m`,\n yellow: (s: string) => `\\x1b[33m${s}\\x1b[0m`,\n green: (s: string) => `\\x1b[32m${s}\\x1b[0m`,\n bold: (s: string) => `\\x1b[1m${s}\\x1b[0m`,\n dim: (s: string) => `\\x1b[2m${s}\\x1b[0m`,\n};\n\n/**\n * Subresource Integrity for a script-tag build shipped next to this CLI\n * (dist/cli → dist). It's the same file jsDelivr serves for this exact\n * version, so a tampered CDN copy won't run.\n */\nfunction sri(file: string): string | null {\n try {\n const data = readFileSync(new URL(`../${file}`, import.meta.url));\n return `sha384-${createHash('sha384').update(data).digest('base64')}`;\n } catch {\n return null; // running from source\n }\n}\n\n/** A script tag pinned to this exact version, with integrity hashes. */\nexport function cdnScriptTag(live?: { server: string; projectKey: string }): string {\n const file = live ? 'loader.global.js' : 'grabby.global.js';\n const own = sri(file);\n // The loader fetches the full build itself; data-integrity covers that file.\n const full = live ? sri('grabby.global.js') : null;\n const attrs = [\n `src=\"https://cdn.jsdelivr.net/npm/${PKG}@${GRABBY_VERSION}/dist/${file}\"`,\n ...(own ? [`integrity=\"${own}\"`, 'crossorigin=\"anonymous\"'] : []),\n ...(full ? [`data-integrity=\"${full}\"`] : []),\n ...(live ? ['data-mode=\"live\"', `data-server=\"${live.server}\"`, `data-project-key=\"${live.projectKey}\"`] : []),\n 'defer',\n ];\n return `<script ${attrs.join(' ')}></script>`;\n}\n\nconst log = (msg = '') => console.log(msg && `${c.cyan('[grabby]')} ${msg}`);\nconst warn = (msg: string) => console.log(`${c.yellow('[grabby]')} ${msg}`);\n\ninterface Change {\n file: string;\n describe: string;\n next: string;\n}\n\nfunction tryPatch(file: string | null, patch: (code: string) => PatchResult, describe: string, manual: string, changes: Change[], manualSteps: string[]): void {\n if (!file || !existsSync(file)) {\n manualSteps.push(manual);\n return;\n }\n const result = patch(readFileSync(file, 'utf8'));\n if (result.status === 'patched') changes.push({ file, describe, next: result.code });\n else if (result.status === 'already') log(`${describe}: already set up`);\n else manualSteps.push(`${manual}\\n ${c.dim(`(couldn't edit ${file} automatically: ${result.reason})`)}`);\n}\n\n/** What to change for each stack. Anything not safely automatable becomes a manual step. */\nfunction plan(stack: Stack, options: InitOptions): { changes: Change[]; manual: string[]; devDependency: boolean } {\n const changes: Change[] = [];\n const manual: string[] = [];\n const live = options.live;\n const liveCall = live ? `initGrabbyLive({ server: '${live.server}', projectKey: '${live.projectKey}' })` : '';\n\n switch (stack.framework) {\n case 'angular': {\n tryPatch(join(stack.root, 'angular.json'), patchAngularJson, 'use the Grabby builders',\n 'In angular.json, set build → \"@githumbi/grabby:application\" and serve → \"@githumbi/grabby:dev-server\".', changes, manual);\n const appConfig = ['src/app/app.config.ts', 'src/app.config.ts'].map((f) => join(stack.root, f)).find((f) => existsSync(f)) ?? null;\n tryPatch(appConfig, patchAngularAppConfig, 'add provideGrabby()',\n \"In app.config.ts: import { provideGrabby } from '@githumbi/grabby/angular'; and add provideGrabby() to providers.\", changes, manual);\n if (live) manual.push(`For live feedback, pass the options: provideGrabby({ mode: 'live', server: '${live.server}', projectKey: '${live.projectKey}' })`);\n break;\n }\n case 'react':\n case 'vue':\n case 'svelte':\n case 'solid':\n case 'preact': {\n if (stack.framework !== 'svelte' && !live) {\n tryPatch(stack.viteConfig, patchViteConfig, 'add the source-location plugin',\n \"In your bundler config add the plugin first: import grabby from '@githumbi/grabby/plugin'; plugins: [grabby.vite(), …] (also grabby.webpack(), grabby.rspack(), …)\", changes, manual);\n }\n tryPatch(stack.entry, (code) => patchEntry(code, { live }), live ? 'start live feedback' : 'start Grabby in development builds',\n live\n ? `In your entry file: import { initGrabbyLive } from '@githumbi/grabby/live'; ${liveCall};`\n : \"In your entry file: import { initGrabby } from '@githumbi/grabby'; if (import.meta.env.DEV) initGrabby();\", changes, manual);\n break;\n }\n case 'next':\n manual.push(\n \"next.config: const grabby = require('@githumbi/grabby/plugin').default; webpack: (config) => { config.plugins.unshift(grabby.webpack()); return config; }\",\n live\n ? `In a client component rendered by your root layout: useEffect(() => { import('@githumbi/grabby/live').then((g) => g.${liveCall}); }, []);`\n : \"In a client component rendered by your root layout: useEffect(() => { if (process.env.NODE_ENV === 'development') import('@githumbi/grabby').then((g) => g.initGrabby()); }, []);\",\n );\n break;\n case 'nuxt':\n case 'sveltekit':\n case 'astro':\n manual.push(\n stack.framework === 'nuxt' ? \"nuxt.config: vite: { plugins: [require('@githumbi/grabby/plugin').default.vite()] }\" : 'No build plugin needed for Svelte-based apps; Astro can add grabby.vite() under vite.plugins.',\n live\n ? `In a client-only script/plugin: import('@githumbi/grabby/live').then((g) => g.${liveCall});`\n : \"In a client-only script/plugin: if (import.meta.env.DEV) import('@githumbi/grabby').then((g) => g.initGrabby());\",\n );\n break;\n default:\n manual.push(`Add before </body>:\\n ${cdnScriptTag(live)}`);\n }\n\n return { changes, manual, devDependency: !live };\n}\n\nasync function confirm(question: string): Promise<boolean> {\n if (!process.stdin.isTTY) return false;\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n const answer = await new Promise<string>((resolve) => rl.question(question, resolve));\n rl.close();\n return /^y(es)?$/i.test(answer.trim());\n}\n\nexport async function init(options: InitOptions = {}): Promise<void> {\n const stack = detectStack(options.cwd);\n const rel = (f: string) => relative(stack.root, f) || f;\n log(`Project: ${stack.root}`);\n log(`Detected: ${stack.framework}${stack.viteConfig ? ' + Vite' : ''} · ${stack.packageManager}${options.live ? ' · live feedback' : ''}`);\n log();\n\n const { changes, manual, devDependency } = plan(stack, options);\n const install = stack.hasPackageJson && !options.noInstall ? installCommand(stack.packageManager, PKG, devDependency) : null;\n\n if (!install && changes.length === 0 && manual.length === 0) {\n log(c.green('Everything is already set up.'));\n return;\n }\n\n console.log(c.bold(' Grabby will:'));\n if (install) console.log(` • run ${c.bold(install)}`);\n for (const ch of changes) console.log(` • edit ${c.bold(rel(ch.file))}: ${ch.describe}`);\n if (manual.length) {\n console.log(c.bold('\\n You\\'ll need to do by hand:'));\n manual.forEach((m, i) => console.log(` ${i + 1}. ${m}`));\n }\n console.log('');\n\n if (options.dryRun) return;\n if (changes.length || install) {\n const go = options.yes || await confirm(' Go ahead? [y/N] ');\n if (!go) {\n warn(process.stdin.isTTY ? 'Nothing changed.' : 'Nothing changed (not a terminal; re-run with --yes to apply).');\n return;\n }\n }\n\n if (install) {\n try {\n execSync(install, { cwd: stack.root, stdio: 'inherit' });\n } catch {\n warn(`Install failed; run it yourself: ${install}`);\n }\n }\n for (const ch of changes) {\n writeFileSync(ch.file, ch.next, 'utf8');\n log(`${c.green('✓')} ${rel(ch.file)}`);\n }\n\n console.log('');\n log(c.green('Done.'));\n if (options.live) {\n console.log(`\\n Share this feedback link with reviewers: ${c.bold(`https://<your-site>/?grabby=${options.live.projectKey}`)}`);\n console.log(` Pull their comments: ${c.bold(`npx -y ${SERVER_PACKAGE} pull --server ${options.live.server} --token <admin token>`)}\\n`);\n } else {\n console.log(`\\n Start your dev server, press ${c.bold('Alt+G')} (${c.bold('Option+G')} on Mac), click anything, and comment.`);\n console.log(` Then use ${c.bold('Copy all')} and paste into your AI agent.`);\n console.log(` Want your agent to read comments directly? Run ${c.bold('npx @githumbi/grabby add mcp')}.\\n`);\n }\n}\n","import { existsSync, readFileSync } from 'fs';\nimport { join, dirname } from 'path';\n\nexport type PackageManager = 'pnpm' | 'yarn' | 'bun' | 'npm';\nexport type Framework = 'angular' | 'next' | 'nuxt' | 'sveltekit' | 'astro' | 'react' | 'vue' | 'svelte' | 'solid' | 'preact' | 'html';\n\nexport interface Stack {\n root: string;\n packageManager: PackageManager;\n framework: Framework;\n /** vite.config.* when the project builds with Vite. */\n viteConfig: string | null;\n /** The file that mounts the app, where initGrabby() goes. */\n entry: string | null;\n hasPackageJson: boolean;\n}\n\nconst VITE_CONFIGS = ['vite.config.ts', 'vite.config.mts', 'vite.config.js', 'vite.config.mjs'];\nconst ENTRIES = ['src/main.tsx', 'src/main.ts', 'src/main.jsx', 'src/main.js', 'src/index.tsx', 'src/index.jsx', 'src/index.ts', 'src/index.js'];\n\nexport function findProjectRoot(start: string = process.cwd()): string {\n let dir = start;\n while (true) {\n if (existsSync(join(dir, 'package.json'))) return dir;\n const parent = dirname(dir);\n if (parent === dir) return start;\n dir = parent;\n }\n}\n\nexport function detectPackageManager(root: string): PackageManager {\n // Walk up for lockfiles too: a workspace package's lockfile lives at the repo root.\n let dir = root;\n while (true) {\n if (existsSync(join(dir, 'pnpm-lock.yaml'))) return 'pnpm';\n if (existsSync(join(dir, 'yarn.lock'))) return 'yarn';\n if (existsSync(join(dir, 'bun.lockb')) || existsSync(join(dir, 'bun.lock'))) return 'bun';\n if (existsSync(join(dir, 'package-lock.json'))) return 'npm';\n const parent = dirname(dir);\n if (parent === dir) return 'npm';\n dir = parent;\n }\n}\n\nexport function detectStack(start: string = process.cwd()): Stack {\n const root = findProjectRoot(start);\n const pkgPath = join(root, 'package.json');\n const hasPackageJson = existsSync(pkgPath);\n let deps: Record<string, string> = {};\n if (hasPackageJson) {\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));\n deps = { ...pkg.dependencies, ...pkg.devDependencies };\n } catch { /* unreadable package.json: treat as plain HTML */ }\n }\n const has = (name: string) => name in deps;\n\n let framework: Framework = 'html';\n if (existsSync(join(root, 'angular.json')) || has('@angular/core')) framework = 'angular';\n else if (has('next')) framework = 'next';\n else if (has('nuxt')) framework = 'nuxt';\n else if (has('@sveltejs/kit')) framework = 'sveltekit';\n else if (has('astro')) framework = 'astro';\n else if (has('solid-js')) framework = 'solid';\n else if (has('preact')) framework = 'preact';\n else if (has('react')) framework = 'react';\n else if (has('vue')) framework = 'vue';\n else if (has('svelte')) framework = 'svelte';\n\n const viteConfig = VITE_CONFIGS.map((f) => join(root, f)).find((f) => existsSync(f)) ?? null;\n const entry = ENTRIES.map((f) => join(root, f)).find((f) => existsSync(f)) ?? null;\n\n return { root, packageManager: detectPackageManager(root), framework, viteConfig, entry, hasPackageJson };\n}\n\nexport function installCommand(pm: PackageManager, pkg: string, dev: boolean): string {\n switch (pm) {\n case 'pnpm': return `pnpm add ${dev ? '-D ' : ''}${pkg}`;\n case 'yarn': return `yarn add ${dev ? '-D ' : ''}${pkg}`;\n case 'bun': return `bun add ${dev ? '-d ' : ''}${pkg}`;\n default: return `npm install ${dev ? '-D ' : ''}${pkg}`;\n }\n}\n","/*\n * Small, conservative source edits. Each patch either applies cleanly to a\n * recognisable pattern or declines, so `grabby init` never writes a guess;\n * when it declines, init prints the lines to add by hand instead.\n */\n\nexport type PatchResult =\n | { status: 'patched'; code: string }\n | { status: 'already' }\n | { status: 'unrecognised'; reason: string };\n\n/** Index just after the last top-level import statement (0 when there are none). */\nfunction afterImports(code: string): number {\n const re = /^import\\s[^;]*?(?:from\\s+)?['\"][^'\"]+['\"];?[ \\t]*$/gm;\n let end = 0;\n for (let m = re.exec(code); m; m = re.exec(code)) end = m.index + m[0].length;\n return end;\n}\n\nfunction insertImport(code: string, statement: string): string {\n const at = afterImports(code);\n if (at === 0) return `${statement}\\n${code}`;\n return `${code.slice(0, at)}\\n${statement}${code.slice(at)}`;\n}\n\n/** Adds `grabby.vite()` first in the `plugins: [...]` array of a Vite config. */\nexport function patchViteConfig(code: string): PatchResult {\n if (code.includes('@githumbi/grabby/plugin')) return { status: 'already' };\n const plugins = /plugins\\s*:\\s*\\[/.exec(code);\n if (!plugins) return { status: 'unrecognised', reason: 'no `plugins: [ … ]` array found' };\n const at = plugins.index + plugins[0].length;\n // First, so it stamps source before framework plugins compile it.\n const withPlugin = `${code.slice(0, at)}grabby.vite(), ${code.slice(at)}`;\n return { status: 'patched', code: insertImport(withPlugin, \"import grabby from '@githumbi/grabby/plugin';\") };\n}\n\n/** Starts Grabby in the app's entry file, in development builds only. */\nexport function patchEntry(code: string, options: { live?: { server: string; projectKey: string } } = {}): PatchResult {\n if (code.includes('@githumbi/grabby')) return { status: 'already' };\n const at = afterImports(code);\n if (at === 0 && /\\bimport\\b/.test(code.slice(0, 200))) {\n return { status: 'unrecognised', reason: 'could not find where the imports end' };\n }\n const call = options.live\n ? `initGrabbyLive({ server: ${JSON.stringify(options.live.server)}, projectKey: ${JSON.stringify(options.live.projectKey)} });`\n : 'if (import.meta.env.DEV) initGrabby();';\n const imp = options.live\n ? \"import { initGrabbyLive } from '@githumbi/grabby/live';\"\n : \"import { initGrabby } from '@githumbi/grabby';\";\n const withImport = insertImport(code, imp);\n const afterAll = afterImports(withImport);\n return { status: 'patched', code: `${withImport.slice(0, afterAll)}\\n\\n${call}${withImport.slice(afterAll)}` };\n}\n\n/**\n * Swaps the Angular builders for Grabby's, editing the builder strings in\n * place so angular.json keeps its formatting (and any comments).\n */\nexport function patchAngularJson(code: string): PatchResult {\n if (code.includes('@githumbi/grabby:')) return { status: 'already' };\n const next = code\n .replace(/\"@angular(?:-devkit\\/build-angular|\\/build):application\"/g, '\"@githumbi/grabby:application\"')\n .replace(/\"@angular(?:-devkit\\/build-angular|\\/build):dev-server\"/g, '\"@githumbi/grabby:dev-server\"');\n if (next === code) {\n return { status: 'unrecognised', reason: 'no @angular/build:application or :dev-server builder found (Angular 17+ is required)' };\n }\n return { status: 'patched', code: next };\n}\n\n/** Adds provideGrabby() to the providers array of app.config.ts. */\nexport function patchAngularAppConfig(code: string): PatchResult {\n if (code.includes('provideGrabby')) return { status: 'already' };\n const providers = /providers\\s*:\\s*\\[/.exec(code);\n if (!providers) return { status: 'unrecognised', reason: 'no `providers: [ … ]` array found' };\n const at = providers.index + providers[0].length;\n const withProvider = `${code.slice(0, at)}provideGrabby(), ${code.slice(at)}`;\n return { status: 'patched', code: insertImport(withProvider, \"import { provideGrabby } from '@githumbi/grabby/angular';\") };\n}\n","declare const __GRABBY_VERSION__: string;\ndeclare const __GRABBY_SERVER_VERSION__: string;\n\n/** This package's version, filled in at build time. */\nexport const GRABBY_VERSION = __GRABBY_VERSION__;\n\n/**\n * The collector, pinned to an exact version. An MCP server runs with your\n * editor's permissions, and `npx` re-resolves a range on every launch, so a\n * range would let one bad publish reach every user at once. Re-running\n * `grabby add mcp` after upgrading Grabby moves the pin.\n */\nexport const SERVER_PACKAGE = `@githumbi/grabby-server@${__GRABBY_SERVER_VERSION__}`;\n","import { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\nimport { SERVER_PACKAGE as MCP_PACKAGE } from '../versions';\nconst MCP_SERVER_NAME = 'grabby';\n\nfunction log(msg: string): void {\n console.log(`\\x1b[36m[grabby]\\x1b[0m ${msg}`);\n}\n\nfunction warn(msg: string): void {\n console.log(`\\x1b[33m[grabby]\\x1b[0m ${msg}`);\n}\n\nfunction success(msg: string): void {\n console.log(`\\x1b[32m[grabby]\\x1b[0m ${msg}`);\n}\n\nfunction getMcpServerEntry(): { type: string; command: string; args: string[] } {\n const isWindows = process.platform === 'win32';\n if (isWindows) {\n return {\n type: 'stdio',\n command: 'cmd',\n args: ['/c', 'npx', '-y', MCP_PACKAGE, 'mcp'],\n };\n }\n return {\n type: 'stdio',\n command: 'npx',\n args: ['-y', MCP_PACKAGE, 'mcp'],\n };\n}\n\nexport async function addMcp(): Promise<void> {\n log('Adding grabby MCP server...\\n');\n\n const mcpJsonPath = join(process.cwd(), '.mcp.json');\n let config: Record<string, unknown> = {};\n\n if (existsSync(mcpJsonPath)) {\n try {\n config = JSON.parse(readFileSync(mcpJsonPath, 'utf-8'));\n } catch {\n // Never clobber a file we can't read: it may hold other servers' config.\n warn('.mcp.json exists but is not valid JSON; leaving it alone. Add this entry by hand:');\n console.log(JSON.stringify({ mcpServers: { [MCP_SERVER_NAME]: getMcpServerEntry() } }, null, 2));\n return;\n }\n }\n\n const servers = (config.mcpServers as Record<string, unknown>) ?? {};\n servers[MCP_SERVER_NAME] = getMcpServerEntry();\n config.mcpServers = servers;\n\n writeFileSync(mcpJsonPath, JSON.stringify(config, null, 2) + '\\n');\n success('Added grabby MCP server to .mcp.json');\n\n console.log('');\n console.log(' It also collects comments from your app on http://localhost:3456.');\n console.log(\" Point Grabby at it: initGrabby({ server: 'http://localhost:3456' })\");\n console.log('');\n console.log(' \\x1b[1mRestart your editor\\x1b[0m to activate the MCP connection.');\n console.log(' When prompted, \\x1b[1mapprove the MCP server\\x1b[0m in your editor.');\n console.log('');\n}\n"],"mappings":";;;AAAA,SAAS,aAAa;AACtB,SAAS,iBAAiB;;;ACD1B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,cAAAA,aAAY,gBAAAC,eAAc,qBAAqB;AACxD,SAAS,QAAAC,OAAM,gBAAgB;AAC/B,SAAS,uBAAuB;;;ACJhC,SAAS,YAAY,oBAAoB;AACzC,SAAS,MAAM,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E,OAAO,IAAI,UAAU;AAAA,IAC3B,MAAM,KAAK,MAAM,UAAU,IAAI,CAAC;AAAA,IAChC,SAAS;AAAA,MACP,KAAK,EAAE,MAAM,WAAW,OAAO,IAAI;AAAA,MACnC,WAAW,EAAE,MAAM,UAAU;AAAA,MAC7B,cAAc,EAAE,MAAM,UAAU;AAAA,MAChC,MAAM,EAAE,MAAM,UAAU;AAAA,MACxB,QAAQ,EAAE,MAAM,SAAS;AAAA,MACzB,KAAK,EAAE,MAAM,SAAS;AAAA,IACxB;AAAA,EACF,CAAC;AACD,MAAI,OAAO,SAAS,CAAC,OAAO,UAAU,CAAC,OAAO,MAAM;AAClD,SAAK,yGAAyG;AAAA,EAChH;AACA,OAAK;AAAA,IACH,KAAK,OAAO;AAAA,IACZ,QAAQ,OAAO,SAAS;AAAA,IACxB,WAAW,OAAO,YAAY;AAAA,IAC9B,MAAM,OAAO,OAAO,EAAE,QAAQ,OAAO,QAAS,YAAY,OAAO,IAAK,IAAI;AAAA,EAC5E,CAAC,EAAE,MAAM,IAAI;AACf,WAAW,YAAY,UAAU,YAAY,YAAY,YAAY,MAAM;AACzE,UAAQ,IAAI,IAAI;AAClB,OAAO;AACL,UAAQ,MAAM,oBAAoB,KAAK,KAAK,GAAG,CAAC;AAAA,CAAI;AACpD,UAAQ,IAAI,IAAI;AAChB,UAAQ,KAAK,CAAC;AAChB;","names":["existsSync","readFileSync","join","readFileSync","existsSync","join","existsSync","readFileSync","writeFileSync","join","log","warn","join","existsSync","readFileSync","writeFileSync"]}
|
package/package.json
CHANGED